how to use another xml in same Activity in android -


in project want display data on listview on xml of simpleadapter. show right answer if listview in xml of activity refered in setcontentview. show code.

 public class mainactivity extends actionbaractivity {     string name="name";    string fathername = "fname";    listview lst;    arraylist<hashmap<string, string>> arylist ;   @override   protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     arylist = new arraylist<hashmap<string,string>>();     lst =(listview) findviewbyid(r.id.lst);     hashmap<string,string> hashmap = new hashmap<string, string>();     hashmap.put(name,"aasim");     hashmap.put(fathername,"pervaiz");     arylist.add(hashmap);      simpleadapter sadt = new simpleadapter(mainactivity.this, arylist, r.layout.rss_item_list_row,     new string[]{name,fathername}, new int[]{r.id.title, r.id.pub_date});     lst.setadapter(sadt);     } } 

it show right answer because listview present in xml setcontentview (link) how display on listview if xml not linked in setcontentview.


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -