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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:20:45+00:00 2026-05-30T15:20:45+00:00

I am new to Android, but i know somewhat in Java, and Java EE

  • 0

I am new to Android, but i know somewhat in Java, and Java EE
While communicating with the Server(webservice) , it works fine with the response i am getting from it.
But if there is any time delay more than 5 seconds, it is going to ANR. Now my question is how to check with my java functionality , to know whether the server is responding or not responding . Any ideas in this??

Even some Related examples will help me.

Code Snippet

Handler handler = new Handler(); 
handler.postDelayed(new Runnable() { 
    public void run() { 
             // Problem is if Server is not Working , it delays and the UI wents to ANR 
              if(  sendToWebservice(String_to_send)=="fromWebservice") {
                Toast.makeText(context, "Connected", 500).show();

              }
             else {
                Toast.makeText(context, "Not Connected,Try again ", 500).show();
                finish();
            }
     } 
    }, 5000); 

Additional Info:
I am using jax.ws to create webservice & ksoap api in Android.
Thanks in Advance.

Edit

if(  sendToWebservice(String_to_send).equalIgnorecase("fromWebservice") instead of ==

I missed to put this while framing it into syntax here..!!

  • 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-30T15:20:47+00:00Added an answer on May 30, 2026 at 3:20 pm

    First of All,
    This condition should be,

    if(sendToWebservice(String_to_send).equals("fromWebservice")) 
    

    Now for ANR,

    You can put response timeout in your HTTP request so, if there is time delay then you get timeout response from server, Also if possible display some progress dialog when any webservice call has made in UI thread and your web service call in other worker thread.

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

Sidebar

Related Questions

I am quite new to Android dev, but not Java dev, so doing the
I am fairly new to Android programming, but I am getting pretty good at
I know its a bit silly question, but as i am new to android
I'm brand new to JAva/Eclipse/Android but gearing up! I've got everything installed and working
I'm very new to Java and the Android SDK but I'm almost done with
I am new to android development but I know how to create a starStyled
Howdy, I'm currentyl new to Java and Android but I would like to write
Ok, im fairly new to android but i have managed to teach myself the
I know that eclipse can do this, can Intellij via the new Android support
I am completely new to android, and pretty much a Java newb. I have

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.