Friday, 23 August 2013

ListView, ArrayAdapter in Android

ListView, ArrayAdapter in Android

I need some help with my class
1)I have to make an asynchronous call to the method getTodaysTweets() in
TweetUtil to retrieve data.
2)POPULAR list of data you collected.
3)View dialog for the app work while the asynchronous call of TweetUtil is
in progress.
Class
public class MainActivity extends Activity{
private ListView listOfTweets;
private ArrayAdapter<String> tweetsAdapter;
protected void onCreate (Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listOfTweets = (ListView) findViewById(R.id.listOfTweets);
tweetsAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1);
listOfTweets.setAdapter(tweetsAdapter);
//To:DO Get list of tweets from TweetUtil and populate list
//Do this asynchronus
}
}
public class TweetUtil{
public static List<String> getTodaysTweets(){
List<String> tweets = new ArrayList<String>();
//...getting tweets from twitter.com
//...adding the result to my List<String> tweets
return tweets;
}
}

No comments:

Post a Comment