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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:30:03+00:00 2026-06-13T09:30:03+00:00

I am keep getting an error on my Code. I am trying to call

  • 0

I am keep getting an error on my Code. I am trying to call a new AlertDialog inside of an AlertDialog.
It seems to have a Problem showing salert, but i can’t see why…

public String passA = "";
public String passB = "";

public void createPassword() {
    final AlertDialog.Builder alert = new AlertDialog.Builder(this);
    final AlertDialog.Builder salert = new AlertDialog.Builder(this);
    final EditText input = new EditText(this);
    input.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD
            | InputType.TYPE_CLASS_TEXT);

    salert.setView(input); // edit text added to alert
    alert.setView(input); // edit text added to alert
    salert.setTitle("Widerholen Sie Ihre PIN"); // title setted
    alert.setTitle("Geben Sie eine PIN an"); // title setted

    final OnClickListener b = new OnClickListener() {
        public void onClick(DialogInterface arg0, int arg1) {
            passB = input.getText().toString();
            if (passA.equals(passB)) {
                editor = settings.edit();
                editor.putString("password", passA);
                editor.commit();
                logged_in = true;
                return;
            }
        }
    };
    salert.setPositiveButton("OK", b);

    OnClickListener a = new OnClickListener() {
        public void onClick(DialogInterface arg0, int arg1) {
            passA = input.getText().toString();

            salert.show();
            return;
        }
    };

    alert.setPositiveButton("OK", a);

    alert.setOnCancelListener(new OnCancelListener() {

        public void onCancel(DialogInterface dialog) {
            // TODO Auto-generated method stub
            Functions.writeError("Falsche PIN Eingabe.");
            finish();
        }

    });
    alert.show();
}

The Error i am getting is:

10-24 12:02:32.836: E/AndroidRuntime(2446): FATAL EXCEPTION: main
10-24 12:02:32.836: E/AndroidRuntime(2446): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
10-24 12:02:32.836: E/AndroidRuntime(2446):     at android.view.ViewGroup.addViewInner(ViewGroup.java:3337)
10-24 12:02:32.836: E/AndroidRuntime(2446):     at android.view.ViewGroup.addView(ViewGroup.java:3208)
10-24 12:02:32.836: E/AndroidRuntime(2446):     at android.view.ViewGroup.addView(ViewGroup.java:3188)
10-24 12:02:32.836: E/AndroidRuntime(2446):     at com.android.internal.app.AlertController.setupView(AlertController.java:401)
10-24 12:02:32.836: E/AndroidRuntime(2446):     at com.android.internal.app.AlertController.installContent(AlertController.java:241)
10-24 12:02:32.836: E/AndroidRuntime(2446):     at android.app.AlertDialog.onCreate(AlertDialog.java:336)
10-24 12:02:32.836: E/AndroidRuntime(2446):     at android.app.Dialog.dispatchOnCreate(Dialog.java:353)
10-24 12:02:32.836: E/AndroidRuntime(2446):     at android.app.Dialog.show(Dialog.java:257)
10-24 12:02:32.836: E/AndroidRuntime(2446):     at android.app.AlertDialog$Builder.show(AlertDialog.java:932)
10-24 12:02:32.836: E/AndroidRuntime(2446):     at de.pixelstein.nativ.NativeTestActivity$5.onClick(NativeTestActivity.java:257)
10-24 12:02:32.836: E/AndroidRuntime(2446):     at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:166)
10-24 12:02:32.836: E/AndroidRuntime(2446):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-24 12:02:32.836: E/AndroidRuntime(2446):     at android.os.Looper.loop(Looper.java:137)
10-24 12:02:32.836: E/AndroidRuntime(2446):     at android.app.ActivityThread.main(ActivityThread.java:4514)
10-24 12:02:32.836: E/AndroidRuntime(2446):     at java.lang.reflect.Method.invokeNative(Native Method)
10-24 12:02:32.836: E/AndroidRuntime(2446):     at java.lang.reflect.Method.invoke(Method.java:511)
10-24 12:02:32.836: E/AndroidRuntime(2446):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
10-24 12:02:32.836: E/AndroidRuntime(2446):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
10-24 12:02:32.836: E/AndroidRuntime(2446):     at dalvik.system.NativeStart.main(Native Method)

Any help or information would be helpfull.

  • 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-13T09:30:04+00:00Added an answer on June 13, 2026 at 9:30 am

    You are using one view for multiple dialogs, one view can just have one parent.

    Change:

    final EditText input = new EditText(this);
    
    salert.setView(input); // edit text added to alert
    alert.setView(input); // edit text added to alert
    

    To:

    final EditText firstInput = new EditText(this);
    final EditText secondInput = new EditText(this);
    
    salert.setView(firstInput); // edit text added to alert
    alert.setView(secondInput); // edit text added to alert
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to code some stuff for a game but I keep getting error
I'm trying to call mozRequestAnimationFrame in firefox, but I keep getting an error. Here
I keep getting this error while trying to modify some tables. Here's my code:
I'm trying to get http://www.gelens.org/code/gevent-websocket/ running and keep getting the following error. socket_id=1 already
I keep getting this error whenever I call gethostbyname() in my C code. ==7983==
I am trying to set SignalR up, but I keep getting the following error
I'm trying to access an arrays data from inside a function but keep getting
So im trying to save the output from my subprocess.call but I keep getting
With the following code, I keep getting error C2535 when I compile. It's complaining
I keep getting an error with the following bit of code. It is probably

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.