-10

Possible Duplicate:
How to pass object from one activity to another in Android
Using intents for passing data

Is it possible to pass a value from one activity to other activity. That is there are 3 activities, I have 1 string in 1st activity, I want this string in 3rd activity.

One more I am not going straightly to 3rd activity. I am going form 1 to 2 and 3. In that how can I have a string in activity 1 in activity ..

Community
  • 1
  • 1
prakash .k
  • 635
  • 2
  • 12
  • 24
  • 1
    Dublicate : http://stackoverflow.com/questions/7006957/using-intents-for-passing-data – Haresh Chaudhary Jul 27 '12 at 06:36
  • Hi..thanks for downvoting...By just starting an activity i can pass the value from 1 screen to other..But what i want is,when i press one button it will do calcultion,and have it on an float variable.And it will start 1 activity,but i don't want that float in that activity,i want that in another activity..How its possible??thats i posted here.. – prakash .k Jul 27 '12 at 06:45

1 Answers1

0

You can make use of Application life cycle.

Create Application class, save/update values and access it in the activity where ever you want.

public class MyApplication extends Application {
public static String value;


}

In activity, to save any value, use

MyApplication.value = "some value";

In other activity, if you want this value,

String myValue = MyApplication.value;

Another way is, you can pass intent extras in each activity.

Raghu Nagaraju
  • 3,278
  • 1
  • 18
  • 25