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 7516511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:09:11+00:00 2026-05-30T01:09:11+00:00

My MainActivity spans some (ie. 4) webviews CustomWebView . This class has a static

  • 0

My MainActivity spans some (ie. 4) webviews CustomWebView. This class has a static method BROADCAST that broadcast some message to all instantiated children.

  • so inside the activity context, i can do

    CustomWebView.BROADCAST (BECOME_RED) 
    

    and all CustomWebViews would become red.

  • All is fine but now my main activity spans a subactivity (ie. select a picture activity). The original activity becomes stopped (its onstop() called blah blah blah)

So… What would happen now, in the context of this new subactivity, with its parent activity stopped, should I do:

CustomWebView.BROADCAST (BECOME_RED)
  • I’ve seen it “works” but dont really understand the implications of the owner activity being stopped and I messing with its views accessing them “illegally” from a static context.

  • What about if the static method access the View, but only non-view related stuff such as an ArrayList?

  • What about if the static method does NOT access a child instance, but uses exclusively static variables? Does it make a different?

  • What about the lifetime of the View object (static stuff mainly) when the activity is stopped?

  • 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-30T01:09:13+00:00Added an answer on May 30, 2026 at 1:09 am

    Static members of class live as long as class is loaded (also, as long as JVM is running in case of android). But views are created with a context ( also Activity ) and have pretty intimate private relation – AFAIK, they should not be used with multiple activities.

    Activity stop does not mean that it is destroyed – it can be reactivated at later time. View instances survive this.

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

Sidebar

Related Questions

I have TabActivityGroup: MainActivity class contain some tab, that name loading from db. Sales,
This is my code: public class MainActivity extends Activity { private ComponentName mService; private
I have following code that displays an Image with letters, public class MainActivity extends
I have this structure: 1) main activity: public class mainActivity extends Activity { @Override
I have this code: MainActivity: public class MainActivity extends ActivityGroup In MainActivity, I use
Let's say we have a standard MainActivity that extends Activity . It contains onCreate
findViewById returns null for EditText Java Code: public class MainActivity extends Activity { private
I have the following class: public class MainActivity extends Activity { /** Called when
I have a PushNotificationReceiver (extends BroadcastReceiver) and MainActivity . The receiver sends some data
I implement a project which contain a activity group mainActivity. This main activity contains

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.