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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:19:45+00:00 2026-06-10T18:19:45+00:00

Let me clarify it first that I am still a very amateur android developer

  • 0

Let me clarify it first that I am still a very amateur android developer just started about a week ago by learning from the tutorials on http://developer.android.com/training/basics/firstapp/index.html

So if my code appear to be ugly forgive me for that..

Now the actual problem – “PROGRESS DIALOG DOESN’T APPEAR” – but the rest of the code is working fine. It is sending the SMS and I am receiving them, just facing problem with PROGRESS DIALOG.

public class MainActivity extends Activity {
Context context;

public final static String EXTRA_NUMBER = "com.example.myfirstapp.NUMBER";
public final static String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE";

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

/** Called when the user clicks the Send button */
public void sendMessage(View view) {
    if (!isOnline()) {
        Toast.makeText(MainActivity.this,"No Internet Access..Cannot Send SMS", Toast.LENGTH_LONG).show();
    } else {

        ProgressDialog prgDialog = ProgressDialog.show(MainActivity.this,"Free Sms","Sending SMS..Please Wait..!!",true);           
        EditText editTextNum = (EditText) findViewById(R.id.edit_number);
        EditText editText = (EditText) findViewById(R.id.edit_message);
        String number = editTextNum.getText().toString();
        String message = editText.getText().toString();
        try {
            prgDialog.dismiss();
            String msgreciever = number;
            String testMessage = message;
            SmsSender.sendMessage(msgreciever, testMessage);                
            Toast.makeText(MainActivity.this, "Message Sent Successfully",Toast.LENGTH_LONG).show();
            editTextNum.setText("");
            editText.setText("");
        } catch (Exception ex) {
            prgDialog.dismiss();
            Toast.makeText(MainActivity.this, "Message Sending Failed",Toast.LENGTH_LONG).show();
        }
    }
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_main, menu);
    return true;
}

public boolean isOnline() {
    ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo netInfo = cm.getActiveNetworkInfo();
    if (netInfo != null && netInfo.isConnectedOrConnecting()) {
        return true;
    }
    return false;
}

}
  • 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-10T18:19:46+00:00Added an answer on June 10, 2026 at 6:19 pm

    Hello Tapan Actually You have to use the “Thread” or “Runnable” for this kind of operation… so in the “else” part of your code put this modified code which uses the Thread.. so it will definitly work for you….

    EditText editTextNum = (EditText) findViewById(R.id.edit_number);
    EditText editText = (EditText) findViewById(R.id.edit_message);
    final String number = editTextNum.getText().toString();
    final String message = editText.getText().toString();
    final ProgressDialog prgDialog = ProgressDialog.show(this,"Free Sms","Sending SMS..Please Wait..!!",true);
    Thread t=new Thread(new Runnable() {
        public void run() {
            // TODO Auto-generated method stub
            try {
                Thread.sleep(1000);
                SmsSender.sendMessage(number, message);
                prgDialog.dismiss();
                Toast.makeText(MainActivity.this, "Message Sent Successfully",Toast.LENGTH_LONG).show();
    
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    });
    t.start();
    editTextNum.setText("");
    editText.setText("");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let me first clarify that I am by now very familiar with definitions of
Caveats: Let me first clarify that this is not a question about whether to
First of all, let me clarify that I know you cannot have actual abstract
Just a very general question, that not only applies to this example. Let's say
Before anything, let me first clarify that the below thoughts are purely my personal
Let me first clarify that I'm not much familiar with PHP language, since I
First off, let me clarify the platforms we are using. We have an ASP.NET
I've got a question - BizTalk or WF? And let me clarify that I
Let me first of all clarify a few things: I am not trying to
Let's assume that on a hard drive I have some very large data file

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.