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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:28:54+00:00 2026-06-12T01:28:54+00:00

I want to send some message from asytask to me main activity. I want

  • 0

I want to send some message from asytask to me main activity.
I want to do this with message object (handler).
in my main activity I created this

    final Handler mHandler = new Handler() {
    @Override
    public void handleMessage(Message msg) {
        msg.toString(); 
    }

}; 

the object that I pass to asytask

 new splash(first.this,mHandler).execute();

and the asytask that send message to activity from this method

protected void onPostExecute(String result) {
    Message msg =  new Message();
    Bundle bundle = new Bundle();
    bundle.putString("ActivityName",this.newActivity);
    msg.setData(bundle);
    mHandler.sendMessage(msg);
    Dialog.dismiss();

the logcat

    09-29 11:55:41.631: E/AndroidRuntime(473): FATAL EXCEPTION: main
09-29 11:55:41.631: E/AndroidRuntime(473): java.lang.NullPointerException
09-29 11:55:41.631: E/AndroidRuntime(473):  at tools.splash.onPostExecute(splash.java:109)
09-29 11:55:41.631: E/AndroidRuntime(473):  at tools.splash.onPostExecute(splash.java:1)
09-29 11:55:41.631: E/AndroidRuntime(473):  at android.os.AsyncTask.finish(AsyncTask.java:417)
09-29 11:55:41.631: E/AndroidRuntime(473):  at android.os.AsyncTask.access$300(AsyncTask.java:127)
09-29 11:55:41.631: E/AndroidRuntime(473):  at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
09-29 11:55:41.631: E/AndroidRuntime(473):  at android.os.Handler.dispatchMessage(Handler.java:99)
09-29 11:55:41.631: E/AndroidRuntime(473):  at android.os.Looper.loop(Looper.java:123)
09-29 11:55:41.631: E/AndroidRuntime(473):  at android.app.ActivityThread.main(ActivityThread.java:3683)
09-29 11:55:41.631: E/AndroidRuntime(473):  at java.lang.reflect.Method.invokeNative(Native Method)
09-29 11:55:41.631: E/AndroidRuntime(473):  at java.lang.reflect.Method.invoke(Method.java:507)
09-29 11:55:41.631: E/AndroidRuntime(473):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
09-29 11:55:41.631: E/AndroidRuntime(473):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
09-29 11:55:41.631: E/AndroidRuntime(473):  at dalvik.system.NativeStart.main(Native Method)
  • 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-12T01:28:56+00:00Added an answer on June 12, 2026 at 1:28 am

    According to your comments above the application crashes on Dialog.dismiss().
    Dialog variable is correctly declared and instatiated? Are you making it null somewhere?
    (I suppose Dialog is a variable and not a class, right?)

    EDIT:

    OK, but the problem still remains the same. Have you checked that the mHandler object is properly declared instatiated and it is not null?

    You are passing it as a param in the AsyncTask. Can you post the code where you take the mHandler and you store it “somewhere”?

    Is the AsyncTask in the same scope of the Handler?

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

Sidebar

Related Questions

So i have a problem. I want to send some message from javascript to
Is this possible to do? I want to ping or send some kind of
I want to send some data (NOT MULTIMEDIA) through an SMS message in Android.
I want to send a large blob from biztalk with some metadata to a
I'm creating quick web app that needs to send a php-created message from within
I want to send posts from Android to Facebook wall. Some initial code works
I have some action. I want send mail. usually i doing this way. public
I want to take message from one queue and send it to database. I
I make a bot program and i want to send some keyboard keys between
I am sending email through gmail, i want to send some html content, 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.