[android-developers] how to use AsyncTask
Hello, How can i use Asynctask for the following code: public static String getXML() { String line = null; DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(http://someurl/index.xml;); try { HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); line = EntityUtils.toString(httpEntity); } catch (UnsupportedEncodingException e) { line = results status=\error\msgCan't connect to server/ msg/results; } catch (MalformedURLException e) { line = results status=\error\msgCan't connect to server/ msg/results; } catch (IOException e) { line = results status=\error\msgCan't connect to server/ msg/results; } return line; } this basicaly gets an xml from the website Thanks in advance -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Daily Updating Application
Hello all, I want to develop an app that gives daily news and updates to the user.Some thing like a news app but i want to customize my own layout and fill the appropriate updated content.For example,i give daily updates of a tournament like UPCOMING MATCHES and RESULTS of the previous games.I have no clue how to do it. please help Regards, Aashutosh -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Error
I have a button in main activity which activates another activity whose code is as follows: -- public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.listplaceholder); ArrayListHashMapString, String mylist = new ArrayListHashMapString, String(); String xml = XMLfunctions.getXML(); Document doc = XMLfunctions.XMLfromString(xml); int numResults = XMLfunctions.numResults(doc); if((numResults = 0)){ finish(); } NodeList nodes = doc.getElementsByTagName(tournaments); for (int i = 0; i nodes.getLength(); i++) { HashMapString, String map = new HashMapString, String(); Element e = (Element)nodes.item(i); map.put(id, XMLfunctions.getValue(e, id)); map.put(name, + XMLfunctions.getValue(e, name)); map.put(date, Date Started: + XMLfunctions.getValue(e, date)); map.put(nextmatch, Next Match: + XMLfunctions.getValue(e, nextmatch)); mylist.add(map); } ListAdapter adapter = new SimpleAdapter(this, mylist , R.layout.main1, new String[] { name, date,nextmatch }, new int[] { R.id.item_title, R.id.item_subtitle,R.id.item_subsubtitle }); setListAdapter(adapter); final ListView lv = getListView(); lv.setTextFilterEnabled(true); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView? parent, View view, int position, long id) { if(position==0) { Intent intent=new Intent(Ongoingtournaments.this,info1.class); startActivity(intent); } } the XMLfunctions class do the work of XML parsing. --- after clicking the button my logcat out put says ACTIVITY IDLE TIMEOUT FOR HISTORYRECORD . -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en