Is it possible to create a Dialog
that has Tab
s?
If possible, by selecting one of the Tab
s I have to call an Activity
, is it possible to pass values through a Bundle
?
you can use tabHost class of android for that purpose. http://developer.android.com/reference/android/widget/TabHost.html
in the onItemClick in the list, retrieve the customer name and put it in the intent and call the class that expends tabActivity like this,
Intent intent = new Intent(FirstActivity.this,SecondActivity.class);
Bundle b = new Bundle();
b.putString("name", name);
intent.putExtras(b);
startActivity(intent);
finish();
at the tab activity remove the data from bundle
Resources res = getResources(); // Resource object to get Drawables
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(this, firsttabActivity.class);
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("first").setIndicator("first", res.getDrawable(R.drawable.ic_tab_shuffle)).setContent(intent);
tabHost.addTab(spec);
// Do the same for the other tabs
intent = new Intent().setClass(this, secondtabActivity.class);
spec = tabHost.newTabSpec("second").setIndicator("second", res.getDrawable(R.drawable.ic_tab_shuffle)).setContent(intent);
tabHost.addTab(spec);
now u can pass the customer name along with the intents in the tab and make the activities extract it and use your own logic to use customer name to retrieve customers details. i dont know if there is any more effecient way to do it. this just happened to come to my mind first. i hope it helps.