I am having a TabActivity class which is hosting three tabs Tab1 Tab2 and Tab3 I want to start an activity from tab2 which delivers result to tab1. All the tabs are hosted in a class MyTabActivity.java Plz help guyz
Asked
Active
Viewed 292 times
0
-
I tried to put a string as extras in an intent from tab2. this intent calls Parent Activity class holding all three tabs. I applied Bundle extras=getIntent().getExtras() on onresume() of parent which then put extras in the tab2 here is the code String extra = intent.getStringExtra(name); if (extra != null) { /* String value = extra.getString(name);*/ dialerIntent.putExtra(name,extra); } else{ Log.e("anurag debugging SipHome intent onResume", "no intent data recieved"); } dialerIntent is the intent used for tab1 – anurag Oct 18 '12 at 09:19
3 Answers
0
Activity assigned to tabs cannot be replaced with another activity. Instead try changing its contents.

Shiva
- 559
- 3
- 3
-
then is it possible to fetch data from one tab to another. tab2 is a list activity from where I need to select a value which is required in tab1. – anurag Oct 18 '12 at 09:17
-
Yes , you can fetch data from one tab to another, on list item select, write a static method where you can pass the data and do the changes. And call it when you want to change the data. – Shiva Oct 20 '12 at 08:32
0
You can use public abstract MenuItem add (int groupId, int itemId, int order, int titleRes)
method for this TabActivity like,..
menu.add(1, 1, 1, "TAB1");
and you can refer this link for the next steps,..
http://developer.android.com/reference/android/view/Menu.html#add%28int,%20int,%20int,%20int%29

gowri
- 681
- 9
- 27
0
Got a solution for the issue. It is difficult to start an intent for result when a particular tab is pressed as the result can not be recieved. The simple solution for this is to use public static variables to get data from one class to another.

anurag
- 82
- 2
- 10