The variable that i need to access staticly is a the own MapActivity
instance variable because i need to pass it to another mapView objects
from other activities

public class OsmMapActivity extends MapActivity {
    public static OsmMapActivity instance;
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        View v = new View(this);
        setContentView(v);
        instance=this;

So i am holding a MapActivity instance in a static field of the
MapActivity itself because i need to access it by other activities and
use that variable in some MapView objects. It is a hard need for a
"special" huge app

Then, the variable will be referenced on my active activity, but... it
will be deleted or will be alive if the Android O.S. deletes the
nonvisible MapActivity ??

On 4 ene, 14:08, Mark Murphy <[email protected]> wrote:
> On Wed, Jan 4, 2012 at 7:58 AM, saex <[email protected]> wrote:
> > I have an activity non visible, with some variables that must be
> > accesed by static way. This activity can't be a service, because it is
> > a MapView activity.
>
> > I need to access some static varibales of the activity anytime. I know
> > that the SO can close suspended activities (non visible activities)
> > so.... how can i avoid it? i need that my suspended non visible
> > activitity never get's deleted by the SO.
>
> Fortunately, what you want is impossible. Nothing lives forever.
> Android -- at the specific request of a user or on its own accord --
> can terminate any process it so desires.
>
> You are welcome to use static data members as a cache, but you must
> persist data to files if you want to ensure it survives Android
> terminating your process.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android Training...At Your Office:http://commonsware.com/training

-- 
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

Reply via email to