I am working on tab host application containing 4 tabs. Each tab has individual activity that lists items. on item click of each tab takes to another activity displaying details of clicked list item in same tab host screen layout.
If i press back button after clicking an item from tab host, the application exits. But i need to visit the previously reached list and tabs. How to achieve this? Thanks in Advance
This is my Sample Code –
ListAdapter adapter = new SimpleAdapter(this, mylist , R.layout.list,
new String[] { "title","shortdescription"},
new int[] { R.id.titleTextView,R.id.descriptionTextView});
ListView list = (ListView)findViewById(R.id.statutesListView);
list.setAdapter(adapter);
list.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
HashMap<String, String> hashMap = new HashMap<String, String>();
hashMap = (HashMap<String, String>) parent.getItemAtPosition(position);
String newstitle = hashMap.get("title");
String newsdesc = hashMap.get("shortdescription");
//Get the new Activity to tab.
Intent intent = new Intent(getApplicationContext(), detailedview.class);
Bundle bundle = new Bundle();
bundle.putString("title", newstitle);
bundle.putString("desc", newsdesc);
intent.putExtras(bundle);
View setview = getLocalActivityManager().startActivity("statutes", intent).getDecorView();
setContentView(setview);
}
});
Check this link out and download sample code provided in it and let me know for more requirements
multiple activities in single tab
This code in this link also solves your problem