Android Fabric Twitter Timeline -


i trying show user timeline in android fragment. homefragment.java oncreate() looks this:

public class homefragment extends listfragment {  @injectview(android.r.id.list) listview mtimeline; @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     if (getarguments() != null) {         msectionnumber = getarguments().getint(arg_section_number);     }      final usertimeline usertimeline = new usertimeline.builder().screenname("fabric").build();     final tweettimelinelistadapter adapter = new tweettimelinelistadapter(getactivity(), usertimeline);     setlistadapter(adapter);  } 

and fragment_home.xml has listview:

<listview     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:id="@android:id/list"     android:layout_alignparenttop="true"     android:layout_centerhorizontal="true"/> 

homefragment fragment of homeactivity. code shows empty list. how fix problem? know how setlistadapter(adapter); works. how know list set adapter since can't called on particular list. used twitter fabric page reference when writing code.

inflate custom layout fragment_home.xml in listfragmentby overriding oncreateview.

@override public view oncreateview(layoutinflater inflater, viewgroup container,         bundle savedinstancestate) {     return inflater.inflate(r.layout.fragment_home, container, false); } 

your layout contains listview special @android:id/list id identifies listview listfragment's setlistadapter use.

also, tweettimelinelistadapter listadapter. if you'd find own listview , set adapter yourself, use ordinary fragment (not listfragment).

mtimeline.setlistadapter(adapter)  // mtimeline listview 

the docs include listfragment example.


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -