Dear all,
Please help me how can I auto refresh my application here's my code
package com.show.insaforexquotes;
import java.util.ArrayList;
import java.util.HashMap;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ListAdapter;
import android.widget.SimpleAdapter;
public class Activityinstaforexquotes extends ListActivity {
// All static variables
static final String URL = "url";
// XML node keys
static final String KEY_item = "item"; // parent node
static final String KEY_symbol = "name";
static final String KEY_BID = "middlename";
static final String KEY_ASK = "surname";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activityinstaforexquotes);
ArrayList<HashMap<String, String>> menuItems = new
ArrayList<HashMap<String, String>>();
quotesXMLParsing parser = new quotesXMLParsing();
String xml = parser.getXmlFromUrl(URL); // getting XML
Document doc = parser.getDomElement(xml); // getting DOM element
NodeList nl = doc.getElementsByTagName(KEY_item);
// looping through all item nodes <item>
for (int i = 0; i < nl.getLength(); i++) {
// creating new HashMap
HashMap<String, String> map = new HashMap<String, String>();
Element e = (Element) nl.item(i);
// adding each child node to HashMap key => value
map.put(KEY_name, parser.getValue(e, KEY_name));
map.put(KEY_middlename, parser.getValue(e, KEY_middlename));
map.put(KEY_surname, parser.getValue(e, KEY_surname));
// adding HashList to ArrayList
menuItems.add(map);
}
// Adding menuItems to ListView
ListAdapter adapter = new SimpleAdapter(this, menuItems,
R.layout.showquotes,
new String[] { KEY_name, KEY_middlename, KEY_surname }, new int[] {
R.id.namel, R.id.middlename, R.id.surname });
setListAdapter(adapter);
}
}
How can I put the method of auto update every seconds like time in my
application please help me thank you... I'm a newbie here :)
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en