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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:29:10+00:00 2026-06-10T06:29:10+00:00

Following is the code I have created for 2 dialog boxes: namely Date Picker

  • 0

Following is the code I have created for 2 dialog boxes: namely Date Picker and Custom Dialog Box on submit of 2 buttons namely btnselDate and btnAlertDialog.

Date Picker dialog is working properly but there is some problem with Custom Dialog Box.
My custom dialogbox displays login form for the user.

Kindly please review it and suggest appropriate suggestions for the same.

Here goes the code:

 public void onClick(View view)
    {
        if(view.getId() == R.id.btnselDate)
        {
            // Date Picket DialogBox

            showDialog(1);
        }
        else if(view.getId()==R.id.btnAlertDialog)
        {
            // Alert Dialog Box

            Context mContext = getApplicationContext();
            Dialog dialog = new Dialog(mContext);

            dialog.setContentView(R.layout.custom_activity);
            dialog.setTitle("Custom Dialog");

            TextView text = (TextView) dialog.findViewById(R.id.tvPwd);
            text.setText("Enter the Password");

            final EditText pwd=(EditText) dialog.findViewById(R.id.etPwd);

            Button btnlogin=(Button) dialog.findViewById(R.id.btnOK);

            btnlogin.setOnClickListener(new View.OnClickListener() {

                public void onClick(View v) {
                    // TODO Auto-generated method stub

                    //Login Button

                    if(pwd.getText().toString().equals("abc"))
                    {
                        Intent intent=new Intent(MainActivity.this,WelcomeUser.class);
                        startActivity(intent);
                    }
                    else
                    {
                        Toast.makeText(MainActivity.this, "Wrong Password, Try Again", Toast.LENGTH_SHORT).show();
                    }

                }
            });
        }
        else
        {
            Toast.makeText(MainActivity.this, "No Dialog Selected yet", Toast.LENGTH_SHORT).show();
        }
    }
  • 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-10T06:29:11+00:00Added an answer on June 10, 2026 at 6:29 am

    instead of this

      dialog.setContentView(R.layout.custom_activity);
    

    for a coustom layout for dialog you ll have to inflate the layout check the code here

        LayoutInflater factory = LayoutInflater.from(this);
        final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null);
        return new AlertDialog.Builder(AlertDialogSamples.this)
            .setIcon(R.drawable.alert_dialog_icon)
            .setTitle(R.string.alert_dialog_text_entry)
            .setView(textEntryView)
            .setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
    
                    /* User clicked OK so do some stuff */
                }
            })
            .setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
    
                    /* User clicked cancel so do some stuff */
                }
            })
            .create();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an alert view with two buttons using the following code: UIAlertView
friends, i have created custom title bar using following titlebar.xml file with code <?xml
I have the following table <thead> <tr> <th>Account ID</th> <th>Code</th> <th>Date Created</th> <th>Date Expires</th>
I have created a custom alertdialog by the following code: AlertDialog.Builder builder; AlertDialog alertDialog;
Have the following code which (resides in a dialog box) and serves as an
I have created an ExpandableListView with the following code: <ExpandableListView android:id=@+id/android:list android:layout_width=wrap_content android:layout_height=0dp android:layout_marginTop=5dp
I have the following code which is created with a datalist control: http://jsfiddle.net/vmE2E/1/ But
I have the following code and whichever service is created last works(so my annotations
I have created a PHP code to echo the following div <div id=main_catsel> <select
I have a transparent BufferedImage created with the following code(not relevant how it 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.