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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:43:37+00:00 2026-06-04T03:43:37+00:00

I am creating the application that using <uses-permission android:name=android.permission.INTERNET /> And I am using

  • 0

I am creating the application that using

<uses-permission android:name="android.permission.INTERNET" />

And I am using WebView to launch URL. But when mobile didn’t connected to WIFI and Internet 3G, in WebView appear exactly URL link.

I don’t want user can see the URL link in WebView if no internet connection, how can i do it?

Best Regards,
Virak

  • 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-06-04T03:43:39+00:00Added an answer on June 4, 2026 at 3:43 am

    Check the return of the following function (true for online, false for not) and modify the output depending on what you’re after.

    private boolean haveNetworkConnection() {
            boolean haveConnectedWifi = false;
            boolean haveConnectedMobile = false;
    
            ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
            NetworkInfo[] netInfo = cm.getAllNetworkInfo();
            for (NetworkInfo ni : netInfo) {
                if (ni.getTypeName().equalsIgnoreCase("WIFI"))
                    if (ni.isConnected())
                        haveConnectedWifi = true;
                if (ni.getTypeName().equalsIgnoreCase("MOBILE"))
                    if (ni.isConnected())
                        haveConnectedMobile = true;
            }
            return haveConnectedWifi || haveConnectedMobile;
        }
    

    If what you want is to show a popup or a toast if there is no connectivity, then having that function in your activity will allow you to do the following, which will show the Toast.

    if(!haveNetworkConnection()){
        Toast.makeText(this,"No internet connection",Toast.LENGTH_LONG).show();
    }else{
        //Do whatever you need if there IS connectivity
    }
    

    I like using the function I’m giving you (have no idea where I copied it from, months ago) because it allows me to easily modify it if I need it to only return true if I have wifi or mobile internet, allowing me for instance to download a high definition video only if the wifi connection is available.

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

Sidebar

Related Questions

I am currently creating an application (iPhone/iPad/Android) that uses a map to display houses
I am creating an application that uses popups. However, I would like to animate
I'm creating an application that uses amazon s3 for storage in C#. It may
I'm creating an Android application (Android 2.3.3) that has a header, a footer and
I am creating a application using jmf that will be launched on a user's
I am creating an application in Flex that uses an embedded SQLite database. The
I'm creating a Windows Forms application that uses an embedded WebBrowser control to view
We are creating an application in C# that uses CMIS to query remote repositories
I'm creating an application that uses .Net and Mono, it uses cross-threaded forms as
I'm am creating an ASP.NET 2.0 web application that uses a BasePage.aspx that is

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.