check the addExtra methods on the Intent class On Wed, Nov 3, 2010 at 10:55, Emre A. Yavuz <[email protected]> wrote:
> Hi Vinay, > > Yes, I meant some data of present activity. The trivial method would be > using static variables as you have already mentioned in your reply. That's > actually what I have been doing so far. Using database on the other hand > seems to be an overkill. Anyway, I just wanted to find out whether there is > a better alternative or not. Thanks for your comments. > > TreKing, thanks for your reply as well. > > Cheers, > > Emre > > > ------------------------------ > Date: Wed, 3 Nov 2010 14:44:22 +0530 > Subject: Re: [android-developers] How to pass a Context variable from one > Activity to another ? > From: [email protected] > To: [email protected] > > > Not sure what you mean by context variables.... > > Activity itself is a context... so while starting an activity you can pass > "this" (wild guess) in the bundle. But why would to want to pass it to > another activity? > > Or do u mean some data of present activity would be required in the next > activity. Well then you can use bundle put extras. and then gather extras in > the new activity. > > Or u can use static variables to share data between the two activities or > activity and service. And if you are not comfortable with the static > variables then data base is always there. > > Vinay Julme > ************** > > On Wed, Nov 3, 2010 at 5:36 AM, Emre A. Yavuz <[email protected]> wrote: > > Hi, > > I have a Tab Layout which has two tabs that correspond to one Activity each > ("A" and "B") . When I run my application, let's say by running > MainActivity(), I expect it to display the first Tab and thus run Activity > "A" by default and switch to Activity "B" when the second Tab is selected. > Let's assume I'd like to pass a Context variable in my MainActivity to > either Activity "A" or "B. How should I do it, what is the most efficient > approach ? Any suggestions ? > > Cheers, > > Emre > > > > -- > 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]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > > > > -- > 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]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > > -- > 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]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- 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] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

