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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:58:08+00:00 2026-05-30T01:58:08+00:00

In my android application I have a dialog box in which the user inputs

  • 0

In my android application I have a dialog box in which the user inputs info into an EditText and saves the data. Everything so far worked fine until I added an inputType to the EditTexts. I can’t seem to find the solution to this problem, I’m rather new to android programming and programming in general so it might be a dumb mistake but I can’t figure it out. Here some of the code:

private Dialog dialog() {
    Dialog diUnit = new Dialog(Overzicht.this);
    diUnit.setContentView(R.layout.unitdialog);
    EditText etKM = (EditText) diUnit.findViewById(R.id.etKM);
    etKM.setInputType(InputType.TYPE_CLASS_NUMBER);
    diUnit.setTitle("Add unit");
    diUnit.setCancelable(false);
    diUnit.getWindow().getAttributes().width = LayoutParams.FILL_PARENT;
    bUnitDialogSave = (Button) diUnit.findViewById(R.id.bUnitDialogVoegToe);
    bUnitDialogCancel = (Button) diUnit.findViewById(R.id.bUnitDialogCancel);
    bUnitDialogCancel.setOnClickListener(this);
    bUnitDialogAdd.setOnClickListener(this);
    return diUnit;
}

And the logcat :

image 1

I know it’s not storing the EditText input yet but the problem starts as soon as I add the setInputType line.

  • 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-30T01:58:08+00:00Added an answer on May 30, 2026 at 1:58 am

    Try to inflate the layout R.layout.unitdialog into a View(with the LayoutInflater) and then search for that EditText in the inflated View:

    private Dialog dialog() {
        Dialog diUnit = new Dialog(Overzicht.this);
        LayoutInflater inflater = (LayoutInflater) getLayoutInflater();
        View content = inflater.inflate(R.layout.unitdialog, null);
        diUnit.setContentView(content);
        EditText etKM = (EditText) content.findViewById(R.id.etKM);
        etKM.setInputType(InputType.TYPE_CLASS_NUMBER);
        diUnit.setTitle("Add unit");
        diUnit.setCancelable(false);
        diUnit.getWindow().getAttributes().width = LayoutParams.FILL_PARENT;
        bUnitDialogSave = (Button) diUnit.findViewById(R.id.bUnitDialogVoegToe);
        bUnitDialogCancel = (Button) diUnit.findViewById(R.id.bUnitDialogCancel);
        bUnitDialogCancel.setOnClickListener(this);
        bUnitDialogAdd.setOnClickListener(this);
        return diUnit;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an android application where all the logic is in a dialog box.
I have a custom dialog in my android application. I want to have in
I am developing an android application in which I have passed a string from
I have an Android application that allows the user to connect to his Facebook
I have a service running in my Android application which contains a HashMap that
I am working on my first Android application, and I have run into a
I am developing an android application. Now i have created one function which create
I have using android alert dialog builder to display the some user message(String) as
I am developing an android application in which i have a static listview which
In my Android application, I have a DefaultApplication class which extends android.app.Application , and

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.