0
我已經在我的應用程序中使用Fabric將Twitter API集成到我的項目中,並有一個重定向到空白活動的Twitter登錄。我想在搜索Twitter用戶(僅限用戶)的活動頂部有一個搜索欄。我會如何去做這件事?搜索Twitter用戶應用程序
我已經在我的應用程序中使用Fabric將Twitter API集成到我的項目中,並有一個重定向到空白活動的Twitter登錄。我想在搜索Twitter用戶(僅限用戶)的活動頂部有一個搜索欄。我會如何去做這件事?搜索Twitter用戶應用程序
您需要查詢twitter的搜索。見下面的例子。
private static final String SEARCH_QUERY =「almounir」; //用戶名或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);
}
謝謝!這是一個很好的開始。我的問題是,我該如何做到這一點,結果只是用戶名? – Shah
您可以訪問API,讓你閱讀文檔,看如何搜索用戶? –
我使用fabric安裝了twitter工具箱到android studio,但我相信爲了使用REST api我需要使用retrofit或其他東西(我可以完全錯誤的),所以我看到是否有可能使用套件(並在這方面有一些困難,哈哈)。 – Shah