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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:51:35+00:00 2026-05-23T09:51:35+00:00

I am dealing with my web services and I got a strange problem and

  • 0

I am dealing with my web services and I got a strange problem and I couldn’t able to solve this as I am new to android development. I am getting null pointer exception while I am showing the toast in onPostExecute() method of async task. some one please help me to fix this

if (result.booleanValue()) // here at this line I am getting the error in logcat//

Thanks in advance….!

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    ///////////male female buttons code/////////////
    Button regmalebtn = (Button) findViewById(R.id.regmalebtn); 
    regmalebtn.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            gender="M";
            System.out.println("gender value after  male button click ="+gender);
            Log.v(TAG,"gender value on  male button click ="+gender );
        }
    });
    Button regfemalebtn = (Button)findViewById(R.id.regfemalebtn);
    regfemalebtn.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            gender ="F";
            // System.out.println("gender value on  female button click ="+gender);
            Log.v(TAG,"gender value on  female button click ="+gender );
        }
    });

    ////////////male female button code will ends here/////////////

    Button signin = (Button) findViewById(R.id.regsubmitbtn);
    signin.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            new RegisterTask().execute();
        };
    });
}


private class RegisterTask extends AsyncTask<Void, Void, Boolean> {
    private final ProgressDialog dialog = new ProgressDialog(Register.this);

    protected void onPreExecute() {
        this.dialog.setMessage("Registering...");
        this.dialog.show();
    }


    //  @SuppressWarnings("unused")
    protected Boolean doInBackground(final Void unused) {
        return this.register(); //don't interact with the ui!
    }

    private Boolean register() {
        ************some code for webservices************
    }

    return null;

}

protected void onPostExecute(final Boolean result) {
    if (this.dialog.isShowing()) {
        this.dialog.dismiss();
    }
    if (result.booleanValue()) {
        // show register success dialog
        // I m getting the error at above line

        Toast.makeText(Register.this, "Registerd", Toast.LENGTH_SHORT).show();
    }
    else {
        Toast.makeText(Register.this, "Try Again", Toast.LENGTH_SHORT).show();
    }
}

@Override
protected Boolean doInBackground(Void... params) {
    // TODO Auto-generated method stub
    return register();
}


}   
}

These r the logcat errors

06-28 16:55:56.685: WARN/dalvikvm(708): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
06-28 16:55:56.695: ERROR/AndroidRuntime(708): FATAL EXCEPTION: main
06-28 16:55:56.695: ERROR/AndroidRuntime(708): java.lang.NullPointerException
06-28 16:55:56.695: ERROR/AndroidRuntime(708):     at com.soap.Register$RegisterTask.onPostExecute(Register.java:193)
06-28 16:55:56.695: ERROR/AndroidRuntime(708):     at com.soap.Register$RegisterTask.onPostExecute(Register.java:1)
06-28 16:55:56.695: ERROR/AndroidRuntime(708):     at android.os.AsyncTask.finish(AsyncTask.java:417)
06-28 16:55:56.695: ERROR/AndroidRuntime(708):     at android.os.AsyncTask.access$300(AsyncTask.java:127)
06-28 16:55:56.695: ERROR/AndroidRuntime(708):     at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
06-28 16:55:56.695: ERROR/AndroidRuntime(708):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-28 16:55:56.695: ERROR/AndroidRuntime(708):     at android.os.Looper.loop(Looper.java:123)
06-28 16:55:56.695: ERROR/AndroidRuntime(708):     at android.app.ActivityThread.main(ActivityThread.java:4627)
  • 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-23T09:51:36+00:00Added an answer on May 23, 2026 at 9:51 am

    You are obviously returning null from register method. Either return something that isn’t null or make a null check before calling result.booleanValue().

    You could do that like this:

    if (result == null) {
    
    }
    else if (result.booleanValue()) {
    
    }
    else {
    
    }
    

    By the way, why do you need to return a Boolean and not boolean (primitive type, which can’t be null).

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

Sidebar

Related Questions

I am new to web services. I am dealing with testing APIs in my
I'm dealing with web services (wsdl, ksoap) on Android. After submitting the details (like
I do not have much experience coding systems dealing with web-services. Please help me
I'm new to enterprise Java development, although I'm sure this question equally applies to
I'm using k2SOAP for Android when dealing with webservices. SoapObject request = new SoapObject(NAMESPACE,
I am new to SOAP and dealing with a web service where it would
Currently I am dealing with a web application which uses a txt file as
We're building a set of external web services to be consumed client-side (using jquery/AJAX)
I'm having a lot of headache with the problem described in this topic title.
I'm dealing with a web-service that serves video files (host). They provide you with

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.