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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:34:53+00:00 2026-05-30T00:34:53+00:00

so this is the problem i am having: whenever the publishProgress(sentCount); is called in

  • 0

so this is the problem i am having: whenever the publishProgress(sentCount); is called in the app crashes. I have looked around and still do not know the cause of this. Any help is greatly appreciated! Thanks

class MySmsTask extends AsyncTask<String, Integer, Integer> {

    protected ProgressBar onPreExecute(String...messageData) {
        final ProgressBar progress = progressSend;
        int msgCount = Integer.parseInt(messageData[2]);
        progress.setMax(msgCount);
        progress.setProgress(0);
        return progress;
    }   
    @Override
    protected Integer doInBackground(String... messageData) {
        int sentCount = 0;
        int size = 1;
        int delay = Integer.parseInt(messageData[3]);
        int delayf = delay + 2;
        int msgCount = Integer.parseInt(messageData[2]);
        String message = messageData[1];
        String phoneNo = messageData[0];
        if (phoneNo.length()>0 && message.length()>0){
            for (sentCount = 0; sentCount < msgCount; sentCount++) {
                for (int i = 0; i < size; i++) {
                    sendSMS(messageData[0], messageData[1]);

                    try {
                        publishProgress(sentCount);
                        Thread.sleep(delayf * 1000);

                    } catch (InterruptedException e) {

                        e.printStackTrace();
                    }
                }
            }

        }
        return sentCount;

    }
    protected void onProgressUpdate(Integer... mprogress) {
        progress.setProgress(mprogress[0]);
        /*Toast.makeText(getBaseContext(), "Sent " + mprogress + " messages", Toast.LENGTH_SHORT).show();*/
    }

    protected void onPostExecute(Integer result) {
        Toast.makeText(getBaseContext(), "Sent " + result + " messages", Toast.LENGTH_SHORT).show();
    }

ERROR:

02-18 00:04:44.019: E/AndroidRuntime(32561): FATAL EXCEPTION: main
02-18 00:04:44.019: E/AndroidRuntime(32561): java.lang.NullPointerException
02-18 00:04:44.019: E/AndroidRuntime(32561):    at          txt.messager.app.TxtMessagerActivity$MySmsTask.onProgressUpdate(TxtMessagerActivity.java:85)
02-18 00:04:44.019: E/AndroidRuntime(32561):    at txt.bomber.app.TxtMessagerActivity$MySmsTask.onProgressUpdate(TxtMessagerActivity.java:1)
02-18 00:04:44.019: E/AndroidRuntime(32561):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:432)
02-18 00:04:44.019: E/AndroidRuntime(32561):    at android.os.Handler.dispatchMessage(Handler.java:99)
02-18 00:04:44.019: E/AndroidRuntime(32561):    at android.os.Looper.loop(Looper.java:130)
02-18 00:04:44.019: E/AndroidRuntime(32561):    at android.app.ActivityThread.main(ActivityThread.java:3906)
02-18 00:04:44.019: E/AndroidRuntime(32561):    at java.lang.reflect.Method.invokeNative(Native Method)
02-18 00:04:44.019: E/AndroidRuntime(32561): at java.lang.reflect.Method.invoke(Method.java:507)
02-18 00:04:44.019: E/AndroidRuntime(32561): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:840)
02-18 00:04:44.019: E/AndroidRuntime(32561): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:598)
02-18 00:04:44.019: E/AndroidRuntime(32561):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-05-30T00:34:54+00:00Added an answer on May 30, 2026 at 12:34 am

    The progress set in onPreExecute is a local variable. I don’t know which progress the compiler sees in your onProgressUpdate, but it’s not the same one. Therefore, it’s probably null.

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

Sidebar

Related Questions

So i'm having this problem. I have two tables (Oracle), one is called Destination
I think I'm not the only one having this problem. Whenever I try to
Hey dudes.i am having this problem while symlinking. I have successfully deployed a ruby
It's not the first time I'm having this problem, and it's really bugging me.
I'm having this problem with a form, whenever I submit a form in this
I am having this problem : Whenever, some specific button is clicked my javascript
I am having a problem with a 32-bit ATL dll that I have created---whenever
I'm having this problem: I have two Google maps in one page, showing just
I'm having this problem, same as ever, but never try to find the right
I'm having this problem and I reached a deadlock, I would try anything I've

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.