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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:15:36+00:00 2026-05-18T12:15:36+00:00

I’m trying to implement returning from an Activity without needing to refresh the screen.

  • 0

I’m trying to implement returning from an Activity without needing to refresh the screen. As far as I see, there are 4 possible states to handle:

  1. Both “Use wireless networks” and “Use GPS satellites” are disabled (user is directed to My Location preferences and not allowed to continue if either are are disabled)
  2. One of these two are enabled (1 of 2 possibilities)
    3, Both are enabled

My problem is that after returning from other Activities in my app, setupWebView() is called every time causing a screen refresh delay.

The refresh is somewhat necessary returning from the preferences (e.g. GPS after enabling gets a fix), but certainly not after returning from an Activity as the time delay in re-painting the screen is distracting and slows down the workflow of my app.

Could someone please advise how to handle this within my onResume() so to avoid all the setupWebview calls.

Here is the code from my onResume() within my main Activity:

    @Override
protected void onResume() {
    if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)
            && !locationManager
                    .isProviderEnabled(LocationManager.NETWORK_PROVIDER))
        createMyLocationDisabledAlert();

    if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
        locationManager.requestLocationUpdates(
                LocationManager.GPS_PROVIDER, 500, 0, this);
        mostRecentLocation = locationManager
                .getLastKnownLocation(LocationManager.GPS_PROVIDER);
        if (mostRecentLocation != null)
            setupWebView();
        else {
            mostRecentLocation = locationManager
                    .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
            setupWebView();
        }
    }

    else if (locationManager
            .isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
        locationManager.requestLocationUpdates(
                LocationManager.NETWORK_PROVIDER, 500, 0, this);
        mostRecentLocation = locationManager
                .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
        if (mostRecentLocation != null)
            setupWebView();
        else {
            mostRecentLocation = locationManager
                    .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
            setupWebView();
        }
    }

    // locationManager.requestLocationUpdates(provider, 500, 0, this);
    // mostRecentLocation = locationManager.getLastKnownLocation(provider);
    // } else
    // mostRecentLocation = locationManager
    // .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
    super.onResume();
}
  • 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-18T12:15:37+00:00Added an answer on May 18, 2026 at 12:15 pm

    Use a boolean flag and use it to skip the call to setupWebView() — and perhaps most of the code in your onResume() method — in cases where you know it is safe to skip it. You are the one who is calling startActivity() to go to the location preferences screen, and hence you are the one who knows whether or not you need to call setupWebView().

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.