Sunday, December 23, 2012

[android-developers] Re: Can two applications that run in the same process have different STATIC object values?

AndroidCompile wrote:

I created two Android applications that share the same user Id (sharedUserId) as well as the same process. In the first app, on startup, I set a static int variable to 1 (it's default is 0). In the second app, I load (using reflection) the same class from the other app and read the static int variable. I read 0.

Since both applications run on the same process, I would expect them to share the same static values, no? Can anyone tell me what the mechanism underneath does? (are they using, maybe, different apk/dex loaders and that causes this behavior?)

I'm confused by your use of the terms "application" and "process" as different things. Each Android app runs in its own process.

Show us a simple, self-contained, compilable example
http://sscce.org/
that illustrates your issue and lets us duplicate it.

I am trying to make sense of your question but cannot as you have phrased it. "Load (using reflection) the same class from the other app" just doesn't compute.

So SSCCE - let the code say what you haven't made clear.

-- 
Lew

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate