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

  • Home
  • SEARCH
  • 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 7400161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:09:45+00:00 2026-05-29T04:09:45+00:00

i am new to android. in my application i have a button .i put

  • 0

i am new to android. in my application i have a button .i put a onClick listener to it and in onClick function i am looking to take a alert dilago .and looking to inflate a layout on to it.it is xml file from layouts.in that xml i putt a edite text and spinner .after runnig the application i am able to get that layout xml file on to alertdilago .there is no problem with iflating that onto it.

The problem here is as i am trying to enter something onto edittext and try to to press the positive button the application is getting closed.

in onclick i am writing the code as follows

LayoutInflater inflater=LayoutInflater.from(this);
            View addView=inflater.inflate(R.layout.view_alert, null);
            final EditText input= new EditText(this);
        final Spinner inputsp = (Spinner)findViewById(R.id.spalert);

        new AlertDialog.Builder(NewGbrainyActivity.this)
                .setTitle("ENTER YOUR DETAILS")
                .setView(addView)
                .setPositiveButton("Ok",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog,
                                    int whichButton) {

                                }

                                String value = input.getText().toString();

                                Intent myIntent = new Intent(
                                        "com.pakage.android.newgbrainy.LEVELS");
                                myIntent.putExtra("name", value);

                                int requestCode = 1;
                                startActivityForResult(myIntent,
                                        requestCode);

                                // finish();
                            }
                        })
                .setNegativeButton("Cancel",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog,
                                    int whichButton) {
                                // Do nothing.
                                dialog.dismiss();


                            }
                        }).show();

how should i write the code for taking input and pass it to another activity.please help me

Thank you,
maddy.

  • 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-29T04:09:47+00:00Added an answer on May 29, 2026 at 4:09 am

    You are saying “In that xml I putt a edite text and spinner.” if so then you should get the Editext from the xml layout. Instead to create new. Also get spinner view from xml

     final EditText input= new EditText(this);
     final Spinner inputsp = (Spinner)findViewById(R.id.spalert);
    

    do this

    final EditText input= (EditText) addView.findViewById(R.id.my_editext_id);
    final Spinner inputsp = (Spinner) addView.findViewById(R.id.spalert);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to the android .In my application i have two activities. In the
I'm new to Android development. I have an application that allows the user to
I'm developing an android application, and I have a button which starts/pauses certain simulation
I am completely new to android, and pretty much a Java newb. I have
i'm new at Android world, and i have a doubt, is there any method
I'm really new in Android programming, so I have a simple question getting a
hey, im new to android development and trying to make my first application. What
in my android application I have some buttons that launch the native browser to
I want to implement Facebook Connect in my android application. I have seen a
I'm creating an android application and within it there is a button that will

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.