Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7016395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:46:45+00:00 2026-05-27T22:46:45+00:00

I have an activity non visible, with some variables that must be accesed by

  • 0

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

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;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:46:46+00:00Added an answer on May 27, 2026 at 10:46 pm

    How many variables do you have? I would create a singleton and manage those with maybe SharedSettings. You can create a POJO and save it.

    Also, you could make an object, implement Parcelable interface and pass it to the Activity where you need the information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a non-Activity class (let's call it NonActivity) that needs to post a
I have a non-fullscreen activity (the system notification bar is visible). In order to
I have an activity that has a TabHost containing a set of TabSpecs each
I have this scenario onResume of an activity: @Override protected void onResume() { if
I have a notification which should give me some parameters when opening an activity
So I have different layouts for this one Activity. And I have different classes
I have some information stored as SharedPreferences. I need to access that information from
i saw some info regarding this question in several threads but non suited my
I have an error Cannot make a static reference to the non-static method sendEmptyMessage(int)
OK I know that I may be thinking about this the wrong way but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.