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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:53:11+00:00 2026-05-19T15:53:11+00:00

Here is my problem. I would like to have an AlertDialog that have a

  • 0

Here is my problem. I would like to have an AlertDialog that have a title and a positive button. I want to describe the content of the AlertDialog in a XML file (except for the title/button).
I have created a file called dlg_addpwd.xml in my layout resources.
Here is the code I’m using:

  AlertDialog alert = new AlertDialog.Builder(this);  
  alert.setTitle("Password access");
  alert.setView(findViewById(R.layout.dlg_addpwd));
  alert.setPositiveButton("Add", listenAddPwdDlg);
  alert.show();

I guess the line

  alert.setView(findViewById(R.layout.dlg_addpwd));

is wrong, isn’t it ?
So the main idea of my question is: how to define as a view for an AlertDialog a view described in a XML file?

Thanks

Vincent

  • 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-19T15:53:11+00:00Added an answer on May 19, 2026 at 3:53 pm
        LayoutInflater inflater = (LayoutInflater) 
            getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View layout = inflater.inflate(R.layout.paypaldialog, 
            (ViewGroup) findViewById(R.id.yourDialog));
        AlertDialog.Builder builder = new AlertDialog.Builder(YourClass.this)
            .setView(layout);
        alertDialog = builder.create();
        alertDialog.show();
    

    that is how I do it.

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

Sidebar

Related Questions

Here is my problem. I would like to have a class with a private
I would like to use the OpenID selector found here The problem is that
I suppose similar problem would have been discussed here, but I couldn't find it.
Here's my problem: I have do create a menu/list of actions (which would be
Problem I would like to trace the Uri that will be generated by a
Here is the Problem: Lets say I have something like this: <div id=leftcontainer> <div
I have 1 IIS server that I would like to use to host 2
I would like to have a function that returns the repsonseText of a jQuery.ajax()
I would like to have a counter, that counts backwards, and is stopped if
Here is my problem : I would like to create a specific component with

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.