0

I am getting some glitches while making a tab enabled application.
I want to share data, between two tabs of my application. How can I achieve the same?

Rgds Robert

tanascius
  • 53,078
  • 22
  • 114
  • 136
Girish
  • 605
  • 2
  • 7
  • 10

2 Answers2

13

the correct way is setting a static field into the activity that creates the tabs

 public class greformanews extends TabActivity {

       public static String JorgesysTitle;
...
...
...

so in your Activity defined in tab 1

 @Override
 protected void onPause() { 
    greformanews.JorgesysTitle = "JORGESYS =)";
 super.onPause();
}

in your Activity defined in tab 2

//get  value defined in Activity 1 !:)
String Title =  greformanews.JorgesysTitle
Jorgesys
  • 124,308
  • 23
  • 334
  • 268
0

You need to use intents to different activities, or in that case of tabs.

Go to Android Common Tasks

And look at the subject below "some intent examples". This will get you started.

You basically need to put whatever values you want into a bundle and pass that over to the new activity using intent.putextras();

Jorgesys
  • 124,308
  • 23
  • 334
  • 268
Cameron
  • 1,612
  • 2
  • 16
  • 24