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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:58:43+00:00 2026-05-25T20:58:43+00:00

When i click on list item im get error and closing app. how to

  • 0

When i click on list item im get error and closing app. how to fix it? where im wrong.
im need to show text WTF in custom dialog window

customdialoglayout.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/layout_root"
          android:orientation="vertical"
          android:background="@drawable/kmp"              
         android:layout_width="fill_parent"
         android:layout_height="fill_parent">

<TextView android:id="@+id/dialog_title"        
    android:textColor="#FFF"
    android:textSize="16sp"
    android:layout_width="fill_parent" android:gravity="center"  android:layout_height="30dp" android:layout_marginTop="5dp"/>

<TextView android:id="@+id/dialog_text"     
    android:textColor="#FFF"
    android:layout_height="35dp" android:layout_width="fill_parent"  android:gravity="center"/>

in mainActivity

    @Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);
    String toastMessage = messages.get(position).toString();
    Builder customdialoglayout = new AlertDialog.Builder(this)
    .setCancelable(true)
    .setIcon(R.drawable.icon);
    TextView text = (TextView) findViewById(R.id.dialog_text);
    text.setText("WTF");
    setContentView(R.layout.customdialoglayout);    
}

fixed problem already by:

    Dialog dialog = new Dialog(this);
    dialog.setContentView(R.layout.customdialoglayout);
    dialog.setTitle(rssTitle);
    dialog.setCancelable(true);
    TextView text = (TextView) dialog.findViewById(R.id.dialog_text);
    text.setText("WTF");
    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-05-25T20:58:44+00:00Added an answer on May 25, 2026 at 8:58 pm

    You have to use the .Builder

    here a reference to Android dev Guide!

        AlertDialog.Builder yourDialog =  new AlertDialog.Builder(this);
        yourDialog .setTitle(rssTitle);
        dialog.show();
    

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

Sidebar

Related Questions

In my project, I have a list box. When I click an item on
When I click an element from list, jQuery get class from clicked element and
To show the complete list of available colors, one has to click the color
I am testing a web app where i delete an item from a list.
When I double click on an entry in my Error List or Find Results
I have a dropdown list that I'm converting over to a custom modal dialog.
Is there a way to get the text of a clicked listbox item? So
I have listview with some listadapter after click on item from list I'd like
I have a JList inside a Scrollpane. If you click on the list and
I've got a list of links which have a click event attached to them,

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.