FriendPickerFragment Facebook Android SDK not showing anything -
i don't know what's wrong code. long know code right, still got java.lang.null.pointer in
friendpickerfragment.loaddata(false); i defined friendpickerfragment still, got error
friendpickerfragment = (friendpickerfragment) fragmentmanager.findfragmentbyid(r.id.friend_picker_fragment); here whole code , think it's same facebook sdk sample friendpicker
public class pickfriends extends fragmentactivity { friendpickerfragment friendpickerfragment; public static void populateparameters(intent intent, string userid, boolean multiselect, boolean showtitlebar){ intent.putextra(friendpickerfragment.user_id_bundle_key,userid); intent.putextra(friendpickerfragment.multi_select_bundle_key, multiselect); intent.putextra(friendpickerfragment.show_title_bar_bundle_key,showtitlebar); } @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_pick_friends); fragmentmanager fragmentmanager = getsupportfragmentmanager(); if(savedinstancestate == null){ final bundle args = getintent().getextras(); friendpickerfragment = new friendpickerfragment(args); fragmentmanager.begintransaction() .add(r.id.friend_picker_fragment, friendpickerfragment); //friendpickerfragment = (friendpickerfragment) fragmentmanager.findfragmentbyid(r.id.friend_picker_fragment); } else { friendpickerfragment = (friendpickerfragment) fragmentmanager.findfragmentbyid(r.id.friend_picker_fragment); } friendpickerfragment.setonerrorlistener(new pickerfragment.onerrorlistener() { @override public void onerror(pickerfragment<?> fragment, facebookexception error) { pickfriends.this.onerror(error); } }); friendpickerfragment.setondonebuttonclickedlistener(new pickerfragment.ondonebuttonclickedlistener() { @override public void ondonebuttonclicked(pickerfragment<?> fragment) { selectfriend application = (selectfriend) getapplication(); application.setselectedusers(friendpickerfragment.getselection()); setresult(result_ok,null); finish(); } }); } private void onerror(exception error){ string text = "error exception"; toast toast = toast.maketext(this,text,toast.length_short); toast.show(); } @override protected void onstart(){ super.onstart(); friendpickerfragment.loaddata(false); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.menu_pick_friends, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. action bar // automatically handle clicks on home/up button, long // specify parent activity in androidmanifest.xml. int id = item.getitemid(); //noinspection simplifiableifstatement if (id == r.id.action_settings) { return true; } return super.onoptionsitemselected(item); } }
please me. thank you
Comments
Post a Comment