How to show Hometimeline on listview?

android

#1

I’m new at fabric. I get user’s hometimeline successfully. What kind of way is there binding hometimeline tweets? I wrote following code there doesn’t seem anything

public class TimelineFragment extends Fragment {

    final TweetViewFetchAdapter adapter =
            new TweetViewFetchAdapter<CompactTweetView>(
                    getActivity());

    public TimelineFragment(){}

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.fragment_timeline, container, false);

        final ListView lv = (ListView)view.findViewById(R.id.hometimeline_list);

        StatusesService statusesService = Twitter.getApiClient().getStatusesService();

        statusesService.homeTimeline(200, null, null, null, null, null, null, new Callback<List<Tweet>>() {

            @Override
            public void success(Result<List<Tweet>> result) {

                adapter.setTweets(result.data);
                lv.setAdapter(adapter);
            }

            @Override
            public void failure(TwitterException e) {

            }
        });
        return view;
    }
}
<LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView android:id="@id/android:empty"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center_horizontal|center_vertical"/>

    <ListView android:id="@+id/hometimeline_list"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:drawSelectorOnTop="false"/>
</LinearLayout>

#2

same question , I hope somebody can help us!


#4

Hi @StartappzKE! Great to hear from you. Try the steps listed on this page for some help getting up and running: https://docs.fabric.io/android/twitter/show-timelines.html#examples.

Thanks!