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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:30:12+00:00 2026-05-26T05:30:12+00:00

In Activity A, i override the onCreateDialog to create a dialogbox with EditText In

  • 0

In Activity “A”, i override the onCreateDialog to create a dialogbox with EditText
In Activity “A”‘s onCreate, i call a method which invokes showDialog, then i spawn another activity B using an intent.

I expect the user to enter something in the EditText and then press Ok, then the Intent should be launched!!.,
but what happens is, The dialog box pops up, and the new activity is fired by the Intent.

basically, the code does not wait on OnClickListener for the dialogBox. Is it bebcause DialogBox does not stop the main UI thread?? why is it like this., and what do i need to do to get this behavior of waiting until the user enters something in the dialog box and press Ok to proceed further.

Code template

@Override
protected Dialog onCreateDialog(int id) {
    switch(id) {            
    case DIALOG_TEXT_ENTRY:

        LayoutInflater factory = LayoutInflater.from(this);
        final View textEntryView = factory.inflate(R.layout.alert_dialog, null);

        return new AlertDialog.Builder(ExampleActivityy.this)
            .setTitle(R.string.name_title_string)
            .setView(textEntryView)
            .setPositiveButton(R.string.ok_string, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {

                    /* User clicked OK so do some stuff */
                }
            })
            .setNegativeButton(R.string.cancel_string, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {

                    /* User clicked cancel so do some stuff */
                }
            })
            .create();

           .../...
           .../...
           ...// further down inside onCreate
@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    this.mTitleRightImageButton.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            Intent spawnEmptyIntent = new Intent(Intent.ACTION_INSERT, getIntent().getData());
            showDialog(DIALOG_TEXT_ENTRY); /// UI does not wait here
            onCreateNewList(); // and proceed further to this section
            Log.w(TAG, "Intent action string is " + getIntent().getDataString());
            startActivity(spawnEmptyListIntent); // and launches this activity.
        }
  • 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-26T05:30:13+00:00Added an answer on May 26, 2026 at 5:30 am

    Try this,

    .setPositiveButton(R.string.ok_string, new DialogInterface.OnClickListener()
     {                 
      public void onClick(DialogInterface dialog, int whichButton)
       {                      
         // User clicked OK so do some stuff 
       Intent spawnEmptyIntent = new Intent(Intent.ACTION_INSERT, getIntent().getData());
    
       startActivity(spawnEmptyListIntent);
    
       }             
     }) 
    

    and

    this.mTitleRightImageButton.setOnClickListener(new OnClickListener() {          
      public void onClick(View v) 
      {  
         showDialog(DIALOG_TEXT_ENTRY); /// UI does not wait here
         onCreateNewList(); // and proceed further to this section             
         Log.w(TAG, "Intent action string is " + getIntent().getDataString());
        } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to call a static method from another activity to find a
I'm creating a new database in my Activity like this: @Override public void onCreate(Bundle
This is my code: Activity: @Override public void onCreate(Bundle savedInstanceState) { ... Intent intent
How can I 'clean' values from extra intent? Activity: @Override public void onCreate(Bundle savedInstanceState)
public class screen2 extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.screen2);
I have an Activity where I want to show a ProgressDialog. I override onCreateDialog
public class video extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);
I have this code: public class Home extends Activity{ @Override public void onCreate(Bundle savedInstanceState)
Code: import com.independentsoft.exchange.Service; import android.app.Activity; import android.os.Bundle; public class ContactsToExchangeActivity extends Activity { @Override
I have onPause in activity and works great. This is code @Override protected void

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.