use of twitter4j.Category in project Talon-for-Twitter by klinker24.
the class CategoryFragment method getSuggestions.
public void getSuggestions() {
new Thread(new Runnable() {
@Override
public void run() {
try {
Twitter twitter = Utils.getTwitter(context, DrawerActivity.settings);
int i = 0;
final ResponseList<Category> categories = twitter.getSuggestedUserCategories();
Collections.sort(categories, new Comparator<Category>() {
public int compare(Category result1, Category result2) {
return result1.getName().compareTo(result2.getName());
}
});
((Activity) context).runOnUiThread(new Runnable() {
@Override
public void run() {
listView.setAdapter(new CategoriesArrayAdapter(context, categories));
listView.setVisibility(View.VISIBLE);
LinearLayout spinner = (LinearLayout) layout.findViewById(R.id.list_progress);
spinner.setVisibility(View.GONE);
}
});
} catch (Throwable e) {
e.printStackTrace();
((Activity) context).runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(context, getResources().getString(R.string.no_location), Toast.LENGTH_SHORT).show();
}
});
}
}
}).start();
}
Aggregations