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

  • Home
  • SEARCH
  • 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 912305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:21:28+00:00 2026-05-15T17:21:28+00:00

when the device is not connected to the internet, I send the user to

  • 0

when the device is not connected to the internet, I send the user to the settings

startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS)

but then I’m stuck in the settings page. How can I go back to my main activity?

thanks

Jul

  • 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-15T17:21:29+00:00Added an answer on May 15, 2026 at 5:21 pm

    In that case, the user will have to explicitly go back to your activity (e.g. by pressing the back button a couple of times). I usually do this on my first Activity in those kind of situations:

    @Override
    public void onResume(){
        super.onResume();
        // first, check connectivity
        if ( isOnline ){
            // do things if it there's network connection
        }else{
            // as it seems there's no Internet connection
            // ask the user to activate it
            new AlertDialog.Builder(SplashScreen.this)
                .setTitle("Connection failed")
                .setMessage("This application requires network access. Please, enable " +
                        "mobile network or Wi-Fi.")
                .setPositiveButton("Accept", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // THIS IS WHAT YOU ARE DOING, Jul
                        SplashScreen.this.startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
                    }
                })
                .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        SplashScreen.this.finish();
                    }
                })
                .show();
        }
    }
    

    As you can see, I check the Internet connection in the onResume method, so that it will check if it user activated the WiFi or not.

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

Sidebar

Related Questions

-webkit-device-pixel-ratio query is supported by both iOS and Android but since iOS does not
How can I check if a user has account on an Android device, not
How to check that network is available or not on android device programmatically, which
my htc device USB debugging is detecting in ubuntu 10.10 linux. But its not
I need to tell if my device has Internet connection or not. I found
I need to know if the device is connected via WIFI or not. This
Is a way to gather hardware information to uniquely identify a certain device (not
Possible Duplicate: iOS - Detecting whether or not device support phone calls? I'm writing
Tiles of google maps are not loading on actual device while it works on
Suddenly I am not able to run my application on an emulator or device

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.