java - ListView, ArrayAdapter in Android -
i need class
- i have make asynchronous call method
gettodaystweets()
intweetutil
retrieve data. - popular list of data collected.
- view dialog app work while asynchronous call of
tweetutil
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 list of tweets tweetutil , populate list //do asynchronus } } public class tweetutil{ public static list<string> gettodaystweets(){ list<string> tweets = new arraylist<string>(); //...getting tweets twitter.com //...adding result list<string> tweets return tweets; } }
using asynctask
class that's save day , below tutorial . asynctask class make asynchronous calling database or remote server , it's manage threads work , can call method in custom asynctask
class –
good source :
http://vogella.com/articles/androidbackgroundprocessing/article.html
Comments
Post a Comment