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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:45:29+00:00 2026-06-18T10:45:29+00:00

I’m using this AsyncTask for calling the skype page https://login.skype.com/json/validator?new_username=username for understand if a

  • 0

I’m using this AsyncTask for calling the skype page https://login.skype.com/json/validator?new_username=username for understand if a certain skype contact already exsists.

public class SkypeValidateUserTask extends AsyncTask<String, Void, String>{

protected String doInBackground(String...urls){
    String response = "";
    for(String url:urls){
        DefaultHttpClient client = new DefaultHttpClient();
        HttpGet httpGet = new HttpGet(url);
        try{
            HttpResponse execute = client.execute(httpGet);
            InputStream content = execute.getEntity().getContent();

            BufferedReader buffer = new BufferedReader(new InputStreamReader(content));

            String s="";
            while((s=buffer.readLine()) != null){
                response+=s;
            }
        }catch(Exception ex){
            ex.printStackTrace();
        }
    }
    return response;
}

public void onPostExecute(String result){
    String status="";
    try{    
        JSONObject obj=new JSONObject(result);
        status=obj.getString("status");
    }catch(Exception ex){
        ex.printStackTrace();
    }
    //Log.i("RISULTATO: ","STATO: "+status);

}
}

The main activity call this task for getting skype validation user result. The code is:

String skype = "name.surname.example";  

if(!skype.equalsIgnoreCase("")){
            // check if the skype contact exists
            SkypeValidateUserTask task = new SkypeValidateUserTask();
            task.execute(new String[] {"https://login.skype.com/json/validator?new_username="+skype});  

                // here I need to obtain the result of the thread

        }

My problems are:

  1. I need to get the result of the task (the String status) in the main activity.

  2. After the task.execute call, the next code in main activity is executed without wait for result returned from asynctask.

  • 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-18T10:45:30+00:00Added an answer on June 18, 2026 at 10:45 am

    It is dengerious to use get() method to get the result from async task because It blocks the UI Thread.
    use This Thread where I provided a reusable solutionCallback mechanism to get result from async thread without blocking UI Thread

    I have implemented that with the help of lapslaz

    public JsonData(YourActivityClass activity) 
    {
        this.activity=activity;
        mProgressDialog = new ProgressDialog(activity);
    
    }
    protected void onPostExecute(String jsondata) {
        if (mProgressDialog != null || mProgressDialog.isShowing()){
            mProgressDialog.dismiss();
        }
        if(jsondata!=null) {
            activity.yourcallback(jsondata)
        }
    
    }
    
    And define the yourcallback() in YourActivityClass
    
    private void yourcallback(String data) {
        jsonRecordsData=data;
        showRecordsFromJson();
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am using JSon response to parse title,date content and thumbnail images and place
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
I'm making a simple page using Google Maps API 3. My first. One marker
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am using jsonparser to parse data and images obtained from json response. When
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.