I am trying to get tweets with specific hashtag from a user's timeline (ex- @kkajnabi#suman
) using Fabric in android.
I am able to get tweets from %23suman
(#suman) using below code. But i want to get tweets from %40kkajnabi%23suman
(@kkajnabi#suman).
public class TimelineActivity extends ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.timeline);
TwitterAuthConfig authConfig = new TwitterAuthConfig("xxxxxxbbbbwdqddq", "eieuhquifhioqhfiohqoifhoi");
Fabric.with((this), new TwitterCore(authConfig), new TweetUi());
final SearchTimeline searchTimeline = new SearchTimeline.Builder()
.query("%40kkajnabi%23suman")
.build();
I think this approach is wrong . Anyone plz help me on writing query for %40kkajnabi%23suman
or there is some other approach to do this.
It's a little rough, but here's how to get the user tweets
Then what I would do, is a quick conditional to determine if the Tweet object contains the hashtags that you want from the entities attribute. I'll need to play with this a bit to give you the exact answer you need. I looked at the API, unfortunately there is no argument that I can find for getting a user's timeline and subsequently filtering by tag. So I think you'll need to iterate through. Here's a good reference to the userTimeline() method of the StatusesService class https://twittercommunity.com/t/android-usertimeline-question/30263/2
Again, I will update this answer when I have a chance later today