java - ListView, ArrayAdapter in Android -


i need class

  1. i have make asynchronous call method gettodaystweets() in tweetutil retrieve data.
  2. popular list of data collected.
  3. 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

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -