i am trying to serach username ,hastag by using fabric api . but it always give me o count . may i know how to get username and hastag
my code as below
TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY,
TWITTER_SECRET);
Fabric.with(this, new Twitter(authConfig));
setContentView(R.layout.activity_main);
SearchTimeline searchTimeline = new SearchTimeline.Builder().query(
"#twitterflock").build();
final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter.Builder(
this).setTimeline(searchTimeline).build();
Log.v("ta", "" + adapter.getCount());
can any one help me out
this is a working example of searching a username/hashtag (i'm using this on my App):
private static final String SEARCH_QUERY = "almounir"; //the username or Hshgtag
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout. activity_main);
ListView lv = (ListView) findViewById(R.id.list);
//lv.setEmptyView(findViewById(R.id.loading)); d'ont forget to add loading pic
SearchTimeline searchTimeline = new SearchTimeline.Builder().query(SEARCH_QUERY).build();
final TweetTimelineListAdapter timelineAdapter = new TweetTimelineListAdapter(this, searchTimeline);
lv.setAdapter(timelineAdapter);
}
hope this helps
Get user name from active session and set it for getting timeline.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TwitterSession session = Twitter.getSessionManager().getActiveSession();
String userName = session.getUserName();
final SearchTimeline searchTimeline = new SearchTimeline.Builder()
.query(userName)
.build();
final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter.Builder(getActivity())
.setTimeline(searchTimeline)
.build();
setListAdapter(adapter);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.