use of com.klinker.android.twitter.adapters.ListsArrayAdapter in project Talon-for-Twitter by klinker24.
the class ListsActivity method getLists.
public void getLists() {
new Thread(new Runnable() {
@Override
public void run() {
try {
Twitter twitter = Utils.getTwitter(context, settings);
final ResponseList<UserList> lists;
try {
lists = twitter.getUserLists(settings.myScreenName);
} catch (OutOfMemoryError e) {
return;
}
Collections.sort(lists, new Comparator<UserList>() {
public int compare(UserList result1, UserList result2) {
return result1.getName().compareTo(result2.getName());
}
});
((Activity) context).runOnUiThread(new Runnable() {
@Override
public void run() {
if (lists.size() > 0) {
listView.setAdapter(new ListsArrayAdapter(context, lists));
listView.setVisibility(View.VISIBLE);
} else {
LinearLayout nothing = (LinearLayout) findViewById(R.id.no_content);
try {
nothing.setVisibility(View.VISIBLE);
} catch (Exception e) {
}
listView.setVisibility(View.GONE);
}
LinearLayout spinner = (LinearLayout) findViewById(R.id.list_progress);
spinner.setVisibility(View.GONE);
}
});
} catch (Exception e) {
e.printStackTrace();
((Activity) context).runOnUiThread(new Runnable() {
@Override
public void run() {
LinearLayout nothing = (LinearLayout) findViewById(R.id.no_content);
nothing.setVisibility(View.VISIBLE);
listView.setVisibility(View.GONE);
LinearLayout spinner = (LinearLayout) findViewById(R.id.list_progress);
spinner.setVisibility(View.GONE);
}
});
}
}
}).start();
}
Aggregations