Twitter UserTimeline works, but SearchTimeline never calls the server

I use the exact code example in, but still I don't get any tweets at all for SearchTimeline, i.e.

No Tweet

If I replaced with UserTimeline, I got the results, but of course I need SearchTimelinefor my use case. Has anyone been able to get SearchTimelineto work? Also (fyi) I have a Fabric setting for my application and I can log in using my Twitter accounts.

The exact code, which is like from a document that fails:

public class SearchTimelineFragment extends ListFragment {

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

        final SearchTimeline searchTimeline = new SearchTimeline.Builder()
                .query("#twitterflock")
                .build();
        final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter.Builder(getActivity())
                .setTimeline(searchTimeline)
                .build();
        setListAdapter(adapter);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        return inflater.inflate(R.layout.timeline, container, false);
    }
}

In addition, I am developing without presence on the PlayStore, if that matters.

BESIDES

, . : . , onCreate . , UserTimeline, .

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.d(TAG, "onCreate");
        final SearchTimeline searchTimeline = new SearchTimeline.Builder()
                .query("#twitterflock")
                .build();
        final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter.Builder(getActivity())
                .setTimeline(searchTimeline)
                .setOnActionCallback(new Callback<Tweet>() {
                    @Override
                    public void success(Result<Tweet> result) {
                        Log.d(TAG, "SearchTimeline successful");
                    }

                    @Override
                    public void failure(TwitterException e) {
                        Log.d(TAG, "SearchTimeline failed");
                        e.printStackTrace();
                        ;
                    }
                })
                .build();
        setListAdapter(adapter);
    }

android.support.v4.app.ListFragment;

+4
1

, onCreate, onCreateView onCreate.

listAdapter OnCreateView.

0

Source: https://habr.com/ru/post/1613232/


All Articles