I am trying to show a user timeline in an android fragment. My HomeFragment.java onCreate() looks like 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 my fragment_home.xml has this 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 is a fragment of HomeActivity. This code just shows an empty list. How do I fix this problem? I would also like to know how setListAdapter(adapter);
works. How does it know which list to set the adapter to since it can't be called on any particular list. I used this twitter fabric page for reference when writing this code.