0

I am looking for a way to use Twitter Kit's TweetUI to query within a specific user's tweets and to add the scrollable timeline in my Android app. SearchTimeline allows for querying by keyword, but I don't see any way to query by keyword specific to the user. UserTimeline loads tweets for one specific user, but doesn't have any query methods. Anyone know if it is possible, without having to resort to using the normal Twitter API, and having to make my own adapter?

https://dev.twitter.com/twitterkit/android/show-timelines

etnie1031
  • 63
  • 7

1 Answers1

0

Filter Timeline Twitter Kit provides functionality to filter the Tweets displayed in your app, according to rules you provide. You can use this functionality to filter the tweets. .

    final List<String> handles = 
Arrays.asList("shame", "down", "degrade");
    final FilterValues filterValues = new FilterValues(handles, null, null, null); // or load from JSON, XML, etc
    final TimelineFilter timelineFilter = new BasicTimelineFilter(filterValues, Locale.ENGLISH);


    final UserTimeline userTimeline = new UserTimeline.Builder()
        .screenName("twitterdev")
        .build();
    final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter.Builder(this)
        .setTimeline(userTimeline)
        .setTimelineFilter(timelineFilter)
        .build();
    setListAdapter(adapter);
}

you can use the usertimeline and filter it based on your keywords. Handles list is the keyword list used to filter the tweets.

More details and implementation is given in the link below.

https://dev.twitter.com/twitterkit/android/show-timelines

Malik Ahsan
  • 931
  • 7
  • 10
  • Let me know if that help or you need any further clearance. :) – Malik Ahsan Sep 12 '17 at 21:46
  • Malik, per my understanding, I don't think that you can query using UserTimeline. I get that you can query using SearchTimeline.Builder().query, but that queries through ALL twitter users' tweets. I only want to query within the specific user's tweets. Any ideas on how to do so? – etnie1031 Sep 13 '17 at 02:35
  • I updated my answer with the usertimeline. Give a try and let me know if that works – Malik Ahsan Sep 13 '17 at 18:01
  • Thank you Malik; your answer is very close but doesn't quite work. Using the FilterValues handles actually does the opposite of what I was looking for. The values input for handles are hidden, instead of searched for. As from the show timelines twitter documentation, it says handles "Removes Tweets from specified user or replies to specified user. Uses case-insensitive matching." I want to be able to search for those specific values, instead of removing. Any ideas?? – etnie1031 Sep 22 '17 at 00:49
  • Yes that was for filtering. I mentioned in my answer :) – Malik Ahsan Sep 22 '17 at 05:16
  • well malik, thank you for answering! I am looking for a way to query by keyword, not filter by keyword (as stated in the question), but thank you for your help anyways! – etnie1031 Sep 24 '17 at 16:59