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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:53:53+00:00 2026-06-13T11:53:53+00:00

I have a Custom AlertDialog.Builder but I couldn’t reach the EditText. This is my

  • 0

I have a Custom AlertDialog.Builder but I couldn’t reach the EditText.

This is my DEFAULT Class;

        AlertDialog.Builder Builder = new AlertDialog.Builder(this);

        LayoutInflater Inflater = this.getLayoutInflater();

        View AddCategory = Inflater.inflate(R.layout.category_new, null);

        final EditText etCategoryName = (EditText) AddCategory.findViewById(R.id.btnAddCategory);

        Builder.setView(AddCategory)
        .setTitle("Add Category")
        .setPositiveButton("ADD", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                Time Today = new Time(Time.getCurrentTimezone());
                Today.setToNow();

                //This code has error !...
                String CategoryName = etCategoryName.getText().toString();
            }
        })
        .setNegativeButton("CANCEL", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                dialog.cancel();
            }
        }); 

        Builder.show();

This
String CategoryName = etCategoryName.getText().toString();

This is my Costum AlertDialog layout;

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="60dp" >

<TextView
    android:id="@+id/tvAddCategoryName"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:layout_marginLeft="10dp"
    android:layout_marginTop="15dp"
    android:text="@string/AddCategoryName"
    android:textColor="@color/White"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<EditText
    android:id="@+id/etAddCategoryName"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/tvAddCategoryName"
    android:layout_alignBottom="@+id/tvAddCategoryName"
    android:layout_toRightOf="@+id/tvAddCategoryName"
    android:layout_marginLeft="20dp"
    android:hint="@string/CategoryName"
    android:ems="10" >

    <requestFocus />
</EditText>

Please help me …

  • 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-13T11:53:54+00:00Added an answer on June 13, 2026 at 11:53 am

    try this.

    final EditText etCategoryName = (EditText) AddCategory.findViewById(R.id.etAddCategoryName);
    

    In Your xml file your editText id is etAddCategoryName and in your java file you initialize different name (btnAddCategory).

    So please change btnAddCategory to etAddCategoryName .

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

Sidebar

Related Questions

I'm created a custom AlertDialog, but it have a default black border. How can
I have this simple code: AlertDialog dialog = new AlertDialog.Builder(this).create(); dialog.setTitle (Alert title); dialog.setMessage
I have created a custom AlertDialog with multiple EditText fields using a custom layout.
This question has been asked before: AlertDialog custom title has black border But was
I have created a custom alertdialog by the following code: AlertDialog.Builder builder; AlertDialog alertDialog;
I have a custom alertdialog that inflates this custom layout: <?xml version=1.0 encoding=utf-8?> <RelativeLayout
I have a problem with a custom dialog implemented as below: AlertDialog.Builder dialogBuilder =
I'm trying to have my AlertDialog with a custom list view but can't seem
I have an AlertDialog in my application. It contains a list of custom views
I have custom UITableViewCell . It contains UITextLabel . When I press this cell

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.