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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T20:44:58+00:00 2026-06-18T20:44:58+00:00

I’m trying to make a connection popup like in the man: http://developer.android.com/guide/topics/ui/dialogs.html The exemple

  • 0

I’m trying to make a connection popup like in the man:
http://developer.android.com/guide/topics/ui/dialogs.html

The exemple like the man is done but now I can’t recover the login and the password filled by the user.

Layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="top|center"
        android:contentDescription="@string/logo"
        android:scaleType="center"
        android:src="@drawable/logo" />

    <EditText
        android:id="@+id/edtlogin"
        android:inputType="textEmailAddress"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:layout_marginLeft="4dp"
        android:layout_marginRight="4dp"
        android:layout_marginBottom="4dp"
        android:hint="@string/identifiant" />
    <EditText
        android:id="@+id/edtpassword"
        android:inputType="textPassword"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="4dp"
        android:layout_marginLeft="4dp"
        android:layout_marginRight="4dp"
        android:layout_marginBottom="16dp"
        android:fontFamily="sans-serif"
        android:hint="@string/motdepasse"/>
</LinearLayout>

Class

    public class PopUpConnexion extends DialogFragment {

    private EditText login;


    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this.getActivity());
        // Get the layout inflater
        LayoutInflater inflater = this.getActivity().getLayoutInflater();

        // Inflate and set the layout for the dialog
        // Pass null as the parent view because its going in the dialog layout


        builder.setView(inflater.inflate(R.layout.popup_connexion, null))
        // Add action buttons
               .setPositiveButton(R.string.connexion, new DialogInterface.OnClickListener() {
                   @Override
                   public void onClick(DialogInterface dialog, int id) {


// Here I want to recover the login and the password for sign in.


                   }
               })
               .setNegativeButton(R.string.annuler, new DialogInterface.OnClickListener() {
                   public void onClick(DialogInterface dialog, int id) {
                       PopUpConnexion.this.getDialog().cancel();
                   }
               });    
        return builder.create();
    }

}

I try to recover the values ​​by all means but the object login of EditText type is always null.
Thanks

Edit:

    public class PopUpConnexion extends DialogFragment {

    EditText login;
    EditText password;


    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this.getActivity());
        // Get the layout inflater
        LayoutInflater inflater = this.getActivity().getLayoutInflater();

        View textEntryView = inflater.inflate(R.layout.popup_connexion, null);
        login  = (EditText) textEntryView.findViewById(R.id.edtlogin); // with the debugger we can see it's the good EditText with the id
        login.setText("test"); // we can't see "test" in the EditText


        builder.setView(inflater.inflate(R.layout.popup_connexion, null))
        // Add action buttons
               .setPositiveButton(R.string.connexion, new DialogInterface.OnClickListener() {
                   @Override
                   public void onClick(DialogInterface dialog, int id) {

                            String tmp = "login: " + login.getText().toString() + "|"; // with the debugger we can see it's the good EditText with the id
                          Toast.makeText(getActivity().getApplication().getApplicationContext(), tmp, Toast.LENGTH_SHORT).show();
                   }
               })
               .setNegativeButton(R.string.annuler, new DialogInterface.OnClickListener() {
                   public void onClick(DialogInterface dialog, int id) {
                       PopUpConnexion.this.getDialog().cancel();
                   }
               });     
        return builder.create();
    }

}

With login.setText(“test”); we can conclude that the view who can see isn’t the same that the view who I getText().

Final Edit:

    public class PopUpConnexion extends DialogFragment {

    EditText identifiant;
    EditText motdepasse;
    Button Connexion;

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this.getActivity());
        // Get the layout inflater
        LayoutInflater inflater = this.getActivity().getLayoutInflater();

        View textEntryView = inflater.inflate(R.layout.popup_connexion, null);
        login = (EditText) textEntryView.findViewById(R.id.edtlogin);
        password = (EditText) textEntryView.findViewById(R.id.edtpassword);
        Connexion = (Button) textEntryView.findViewById(R.id.loginButton);


        Connexion.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                Toast.makeText(getActivity().getApplication().getApplicationContext(), login.getText() + " " + password.getText(), Toast.LENGTH_SHORT).show();
            }
        });

        builder.setView(textEntryView);
        return builder.create();
    }

}

Finally I don’t use the event manager like in the man.
I have already tested this technical but I have been some error because of the confussion beetween DialogFragment.OnClickListener and View.OnClickListener when you just write OnClickListener.
Now it’s work, but I think that it exist an better method using the builder.setPositiveButon() & co.

  • 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-18T20:45:00+00:00Added an answer on June 18, 2026 at 8:45 pm

    You want show dialog box frnd. that type you want

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

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to render a haml file in a javascript response like so:
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has

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.