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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:53:05+00:00 2026-06-01T19:53:05+00:00

hello sir in login page i am validating username and password from server database.

  • 0

hello sir in login page i am validating username and password from server database. if net is there means my application is working properly. if i disconnect internet means my application run means it show error application was not responding. how to eliminate this type of error

    i try this code
        if(name.equals("") || pass.equals(""))
            {
                 Toast.makeText(Main.this, "Please Enter Username and Password", Toast.LENGTH_LONG).show();
            }
            else
            {

            try {
                httpclient = new DefaultHttpClient();
                httppost = new HttpPost("server url/login.php");
                // Add your data
                nameValuePairs = new ArrayList<NameValuePair>(2);
               nameValuePairs.add(new BasicNameValuePair("UserEmail", name.trim()));
                nameValuePairs.add(new BasicNameValuePair("Password", pass.trim()));
                httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

                // Execute HTTP Post Request
                response = httpclient.execute(httppost);
                inputStream = response.getEntity().getContent();

                data = new byte[256];

                buffer = new StringBuffer();
                int len = 0;
                while (-1 != (len = inputStream.read(data)) )
                {
                    buffer.append(new String(data, 0, len));
                }

                inputStream.close();
            }

            catch (IOException e) {
                 System.out.println(e);

                 //alertDialog.cancel();

            }
            if(buffer.charAt(0)=='Y')
            {

                Intent intent=new Intent(getApplicationContext(),ManagerHandset.class);
                startActivity(intent);
            }
            else
            {
                Toast.makeText(Main.this, "Invalid Username or password", Toast.LENGTH_LONG).show();
            }
            }
        }
    });

if i want disconnect my net means how to show alert net is not available

  • 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-01T19:53:06+00:00Added an answer on June 1, 2026 at 7:53 pm

    You can check your internet connection through this type of function:

    public boolean isNetworkAvailable(Context context) {
        boolean value = false;
    
        ConnectivityManager connec = (ConnectivityManager) context
                .getSystemService(Context.CONNECTIVITY_SERVICE);
        if (connec.getNetworkInfo(0).getState() == NetworkInfo.State.CONNECTED
                || connec.getNetworkInfo(1).getState() == NetworkInfo.State.CONNECTED) {
            value = true;
        }
    
        // Log.d ("1", Boolean.toString(value) );
        return value;
    }
    

    Remember you have added following permissions in your Manifest file:

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

    Edit

    if (isNetworkAvailable(getApplicationContext()))
    {
           // Do whatever you want to do
    }
    else{
    
             new AlertDialog.Builder(YourActivitName.this)
            .setTitle("Error")
            .setMessage("Your Internet Connection is not available at the moment. Please try again later.")
            .setPositiveButton(android.R.string.ok, null)
            .show();
     }
    

    Hope this will work for you…

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

Sidebar

Related Questions

Hello Sir i want send list of data to php server i use following
Hello sir i send the arraylist through url pass from android to php all
Hello again ladies and gents! OK, following on from my other question on ASP.NET
hello all i am new to iphone development i am working on a application
Hello guys I am working on silverlight and I have issue regarding on database
Hello all in my iphone application after sending login xml request am getting following
Hello we have an SQL server application running over a low bandwith connection. We
Hello Sir i am pass array list through url android to php my arraylistvalues[x,y.z,....]
Hello , I am currently working on the student association's website. The student's association
$(.menu-container).animate({top:25px}); $(.menu-container).animate({top:-900px}); $(.windows-container).animate({top:-730px}); hello sir.. i got a problem on queue in jquery.. what

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.