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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:23:21+00:00 2026-05-15T12:23:21+00:00

public class BabyName extends Activity implements View.OnClickListener, Runnable{ /** Called when the activity is

  • 0
public class BabyName extends Activity implements View.OnClickListener, Runnable{
    /** Called when the activity is first created. */

    Login loginclass=new Login();
    ProgressDialog dialog;

    Thread t=new Thread(this, "sample");

     AlertDialog al;
     long id;
     boolean flg=false;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);        
        Button launch=(Button)findViewById(R.id.login_button);
        launch.setOnClickListener(this);
    }

    public void onClick(View viewparam){
        EditText username=(EditText)findViewById(R.id.txt_username);
        EditText password=(EditText)findViewById(R.id.txt_password);

        String sUserName = username.getText().toString();
        String sPassword = password.getText().toString();


            dialog=ProgressDialog.show(BabyName.this, "", "Please wait for few seconds...", true);

            loginclass.setId(sUserName);
            loginclass.setPassword(sPassword);     
            al=new AlertDialog.Builder(this).create();
            id=t.getId();                
            t.start();          
            message();


    }
    public void run(){    
            Get_Data getdata=new Get_Data();        
            getdata.logincheck(loginclass);
            dialog.dismiss();       
    }

    public void message(){

        if(loginclass.getStatus().trim().equals("true")){           
            dialog.dismiss();
            /*  Intent i = new Intent(BabyNames.this, ChoiceActivity.class);
                startActivityForResult(i, SUB_ACTIVITY_REQUEST_CODE);*/
            }else if(loginclass.getStatus().trim().equals("false")){

                al.setTitle("Error");
                al.setMessage("Username or password incorrect!!");
                al.setButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                      return;
                  } }); 
                al.show();
            }else {

                //al=new AlertDialog.Builder(this).create();
                al.setTitle("Http Error");
                al.setMessage("Not Connected");
                al.setButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                      return;
                  } }); 
                al.show();
            }
    }
}

This is the code of login page of android and when i enter click login button the progressdialog appears and after that alertbox must be shown if username or password incorrect but it is not showing that alert.

so is there any problem in threading or something else?
please help me

  • 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-15T12:23:22+00:00Added an answer on May 15, 2026 at 12:23 pm

    You can’t show a second dialog on top of another dialog.

    You can only show one dialog at a time on top of an activity.

    What you can do, is set the error message on the login view, then dismiss the progress dialog, and when that is dismissed the user will see something went wrong.

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

Sidebar

Related Questions

public class CovariantTest { public A getObj() { return new A(); } public static
public class MyClass { public int Age; public int ID; } public void MyMethod()
public class Test { public static void main(String[] args) { } } class Outer
public class Item { ... } public class Order { public List<Item> Items ...
public class Address { public string ZipCode {get; set;} } public class Customer {
public class doublePrecision { public static void main(String[] args) { double total = 0;
public class WrapperTest { static { print(10); } static void print(int x) { System.out.println(x);
public class WrapperTest { public static void main(String[] args) { Integer i = 100;
I have class A: public class ClassA<T> Class B derives from A: public class
In the following snippet: public class a { public void otherMethod(){} public void doStuff(String

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.