My applications are independent. I used the IntentReceiver and it works. Thank you :-)
On Jun 16, 5:53 pm, "Mark Murphy" <[EMAIL PROTECTED]> wrote: > > what is the best way to pass one String value between 2 applications? > > > I have read the doc about the ContentProvider but I do not really need > > a database and instanciating all these objects involves an unnecessary > > additional amount of memory. > > I'll refer to your two applications as Application A and Application B. > > If Application A is the one responsible for starting Application B, and > the string needs to pass from A to B at startup, put the string as an > "extra" in the Intent you use to start Application B (via startActivity() > or startSubActivity()), and have Application B read that "extra" from the > Intent when it starts up. > > If Application A is launching Application B via startSubActivity(), and > the string needs to pass from B to A when B completes, use a flavor of > setResult() in B that lets you provide the string as part of the results, > which A will get in onActivityResult(). > > Otherwise, you can always set up an intent receiver on A and/or B, > depending on who is setting the string and who is receiving updates to the > string. The one who "sets" the string does so by sending a broadcast > Intent that gets picked up by the other's intent receiver, with the string > value as an "extra". > > If these are really just two activities in the same application, you have > a lot more options, including SharedPreferences, SQLite database, or even > flat files. > > There are probably other options as well, but those are the ones I can > think of off the top of my head. > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > _The Busy Coder's Guide to Android Development_ -- Available Now! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

