Is it possible to call listactivity through tab activity? Basically, I am developing an app with 3 tabs, for which I am using tabactivity. Furthermore, in one of the tabs I want a listview, so I have derived from listactivity.
Now I want the click event to be determined in the listview. Am i missing something?
public class Tabissue extends TabActivity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
TabHost host = getTabHost();
host.addTab(host.newTabSpec("Tab1").setIndicator("Tab1").setContent(new Intent(this,Tab1.class)));
host.addTab(host.newTabSpec("Tab2").setIndicator("Tab2").setContent(new Intent(this,Tab2.class)));
host.setCurrentTab(1);
}
}
Tab1 Class
public class Tab2 extends ListActivity
{
ListView list;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.tab2);
ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
HashMap<String, String> map = new HashMap<String, String>();
map.put("Test1","####");
map.put("Test2", "India");
map.put("Time", "India time");
mylist.add(map);
map = new HashMap<String, String>();
map.put("Test1", "####");
map.put("Test2", "US");
map.put("Time","US time");
mylist.add(map);
map = new HashMap<String, String>();
map.put("Test1", "####");
map.put("Test2", "UK");
map.put("Time", "UK Time");
mylist.add(map);
ListAdapter mSchedule = new SimpleAdapter( this,
mylist,
R.layout.row,
new String[]
{
"India",
"US",
"UK"
},
new int[]
{
R.id.TRAIN_CELL,
R.id.FROM_CELL,
R.id.TO_CELL,
}
);
list.setAdapter(mSchedule);
}
}