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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:57:55+00:00 2026-06-17T06:57:55+00:00

I am trying to make a dialog pop up that displays more information about

  • 0

I am trying to make a dialog pop up that displays more information about an entry in a ListView. The ListView is generating fine, and all the variable for the dialog are initialising fine, but when I try to write the relevant description to the EditText box a NullPointerException is thrown. Any ideas?

@Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    //TODO Add code for action performed on item click here
    // i.e. open dialogue showing details

    // Custom dialog box
    final Dialog dialog = new Dialog(context);
    dialog.setContentView(R.layout.view_dialog);
    dialog.setTitle("Description: " + savedSubjects[position]);

    // set custom dialog components
    EditText descriptionOutput = (EditText) findViewById(R.id.dialogText);
    String descToWrite = savedDescriptions[position]; // I created this in case calling from the array was the problem. In the trace this variable is correctly set.

    descriptionOutput.setText(descToWrite); //the error occurs at this line


    // set dismiss button
    Button dialogButton = (Button) findViewById(R.id.dialogButton);
    //if button is clicked close the dialog
    dialogButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            dialog.dismiss();
        }
    });

    // display the dialog
    dialog.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-17T06:57:57+00:00Added an answer on June 17, 2026 at 6:57 am

    use

    EditText descriptionOutput = (EditText)dialog.findViewById(R.id.dialogText);
    

    instead of

    EditText descriptionOutput = (EditText) findViewById(R.id.dialogText);
    

    to access EditText from dialog layout

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

Sidebar

Related Questions

I am trying to make a dialog that basically asks for the genre of
I am trying to make a semi-transparent Dialog so that you can see the
I am trying to make a dialog button that pops up when i am
I am trying to make a custom dialog with listview which is going to
I have a pop up dialog box and I am trying to make it
I am trying to make a Dialog that has an EditText on it where
I have a question regarding DialogFragment. I am trying to make a dialog that
I am trying to make a custom dialog in Android. Everything works perfectly except
I'm trying make an entity with doctrine that has three associations with other entities
Trying to make this jQuery filter that uses .find case-insensitive. For example, when the

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.