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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:33:34+00:00 2026-06-17T23:33:34+00:00

i have made an activity with some EditTexts in that,and i want to put

  • 0

i have made an activity with some EditTexts in that,and i want to put an alert dialog when user clicked on it.so i have tried the following code,but its not working .can anybuddy please help me shortout the problem,my code is below:

Main.java

package com.theappgeeks.kevingreenwealth;

import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;

public class Calculator2 extends Activity {
Button btn1,btn2;
ImageButton btn3,btn4,btn5;;
SeekBar sk;
EditText et1,et2,et3,et4,et5,et6,et7,et8;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_calculator2);
        btn1=(Button)findViewById(R.id.back2);
        btn2=(Button)findViewById(R.id.Next2);
        btn3=(ImageButton)findViewById(R.id.imageButtonHome2);
        btn4=(ImageButton)findViewById(R.id.imageButtonTraining2);
        btn5=(ImageButton)findViewById(R.id.imageButtonContactUs2);
        sk=(SeekBar)findViewById(R.id.seekBar1);
        sk=(SeekBar)findViewById(R.id.seekBar1);
        sk.setClickable(false);
        sk.setEnabled(false);
        sk.setProgress(sk.getMax()/4);

        et1=(EditText)findViewById(R.id.editTextPropertyCalc1);
        et2=(EditText)findViewById(R.id.editTextPropertyCalc2);
        et3=(EditText)findViewById(R.id.editTextPropertyCalc9);
        et4=(EditText)findViewById(R.id.editTextPropertyCalc4);
        et5=(EditText)findViewById(R.id.editTextPropertyCalc5);
        et6=(EditText)findViewById(R.id.editTextPropertyCalc6);
        et7=(EditText)findViewById(R.id.editTextPropertyCalc7);
        et8=(EditText)findViewById(R.id.editTextPropertyCalc8);

        final AlertDialog a1 = new AlertDialog.Builder(this).create();

        et1.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                a1.setTitle("Auto-generated field");
                a1.setMessage("This field is calculated automatically");
                a1.setButton("Ok", new DialogInterface.OnClickListener() {
                   public void onClick(DialogInterface dialog, int which) {
                      // TODO Add your code for the button here.

                      // Toast.makeText(getApplicationContext(), "Basic Calculator", 1).show();
                   }
                });
                a1.show();
            }
        });

        btn1.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                Intent i1 =new Intent(Calculator2.this,Calculator_1Activity.class);
                startActivity(i1);
            }
        });
        btn2.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                Intent i2 =new Intent(Calculator2.this,Calculator_3Activity.class);
                startActivity(i2);

            }
        });

  btn3.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
            Intent i3=new Intent(Calculator2.this,MainMenuActivity.class);
            startActivity(i3);
            }
        });

 btn4.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
            Intent i4=new Intent(Calculator2.this,TrainingActivity.class);
            startActivity(i4);
            }
        });

 btn5.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
        Intent i5=new Intent(Calculator2.this,ContactUsActivity.class);
        startActivity(i5);
        }
    });
    }
    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
        ((InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE)).toggleSoftInput(0, 0);
        return false;
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_calculator2, menu);
        return true;
    }
}

main.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/linearLayout1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <RelativeLayout
        android:id="@+id/relativeLayout2"
        android:layout_width="fill_parent"
        android:layout_height="80dp"
        android:padding="3dp" >

        <SeekBar
            android:id="@+id/seekBar1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true" />

        <Button
            android:id="@+id/Next2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_alignRight="@+id/seekBar1"
            android:text="Next" />

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBaseline="@+id/Next2"
            android:layout_alignBottom="@+id/Next2"
            android:layout_centerHorizontal="true"
            android:text="Mortage Cover"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textStyle="bold" />

        <Button
            android:id="@+id/back2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/seekBar1"
            android:layout_alignParentTop="true"
            android:text="Back" />

    </RelativeLayout>

        <ScrollView 
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"  android:layout_weight="0.23" android:fillViewport="true">

            <RelativeLayout
                android:id="@+id/relativeLayout2"
                android:layout_width="fill_parent"
                android:layout_height="509dp"
                android:background="#fffff3"
                android:padding="10dp" >

                <EditText
                    android:id="@+id/editTextPropertyCalc1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignLeft="@+id/editTextPropertyCalc5"
                    android:layout_alignParentRight="true"
                    android:layout_alignParentTop="true"
                    android:layout_marginTop="15dp"
                    android:enabled="false"
                    android:focusable="false"
                    android:focusableInTouchMode="false"
                    android:imeOptions="actionNext"
                    android:inputType="numberDecimal" >

                </EditText>

                <EditText
                    android:id="@+id/editTextPropertyCalc2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignLeft="@+id/editTextPropertyCalc1"
                    android:layout_alignParentRight="true"
                    android:layout_below="@+id/editTextPropertyCalc1"
                    android:imeOptions="actionDone"
                    android:enabled="false"
                    android:focusable="false"
                    android:focusableInTouchMode="false"
                    android:inputType="numberDecimal" />

                <EditText
                    android:id="@+id/editTextPropertyCalc3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignLeft="@+id/editTextPropertyCalc1"
                    android:layout_alignParentRight="true"
                    android:layout_below="@+id/editTextPropertyCalc2"
                    android:enabled="false"
                    android:focusable="false"
                    android:focusableInTouchMode="false"
                    android:inputType="numberDecimal" />

                <TextView
                    android:id="@+id/textView2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignBottom="@+id/editTextPropertyCalc3"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentRight="true"
                    android:enabled="false"
                    android:focusable="false"
                    android:focusableInTouchMode="false"
                    android:layout_below="@+id/editTextPropertyCalc3"
                    android:textAppearance="?android:attr/textAppearanceMediumInverse"
                    android:typeface="serif" />

                <EditText
                    android:id="@+id/editTextPropertyCalc4"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignLeft="@+id/editTextPropertyCalc3"
                    android:layout_alignRight="@+id/textView2"
                    android:layout_below="@+id/textView2"
                    android:imeOptions="actionNext"
                    android:enabled="false"
                    android:focusable="false"
                    android:focusableInTouchMode="false"
                    android:inputType="numberDecimal" />

                <EditText
                    android:id="@+id/editTextPropertyCalc5"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignRight="@+id/textView2"
                    android:layout_below="@+id/editTextPropertyCalc4"
                    android:layout_toRightOf="@+id/imageButtonCalcTip1"
                    android:imeOptions="actionNext"
                    android:enabled="false"
                    android:focusable="false"
                    android:focusableInTouchMode="false"
                    android:inputType="numberDecimal" />

                <EditText
                    android:id="@+id/editTextPropertyCalc6"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignLeft="@+id/editTextPropertyCalc4"
                    android:layout_alignParentRight="true"
                    android:layout_below="@+id/editTextPropertyCalc5"
                    android:imeOptions="actionNext"
                    android:enabled="false"
                    android:focusable="false"
                    android:focusableInTouchMode="false"
                    android:inputType="numberDecimal" />

                <EditText
                    android:id="@+id/editTextPropertyCalc7"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignLeft="@+id/editTextPropertyCalc5"
                    android:layout_alignParentRight="true"
                    android:layout_below="@+id/editTextPropertyCalc6"
                    android:imeOptions="actionDone"
                    android:enabled="false"
                    android:focusable="false"
                    android:focusableInTouchMode="false"
                    android:inputType="numberDecimal" />

                <EditText
                    android:id="@+id/editTextPropertyCalc8"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignLeft="@+id/editTextPropertyCalc6"
                    android:layout_alignParentRight="true"
                    android:layout_below="@+id/editTextPropertyCalc7"
                    android:enabled="false"
                    android:focusable="false"
                    android:focusableInTouchMode="false"
                    android:inputType="numberDecimal" />

                <TextView
                    android:id="@+id/TextView01"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignBaseline="@+id/editTextPropertyCalc1"
                    android:layout_alignBottom="@+id/editTextPropertyCalc1"
                    android:layout_alignLeft="@+id/textView2"
                    android:layout_marginTop="15dp"
                    android:text="Price"
                    android:textAppearance="?android:attr/textAppearanceSmallInverse"
                    android:textSize="20dp"
                    android:typeface="serif" />

                <TextView
                    android:id="@+id/TextView03"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignBaseline="@+id/editTextPropertyCalc3"
                    android:layout_alignBottom="@+id/editTextPropertyCalc3"
                    android:layout_alignLeft="@+id/textView2"
                    android:text="Mortage Amount"
                    android:textAppearance="?android:attr/textAppearanceSmallInverse"
                    android:typeface="serif" />

                <TextView
                    android:id="@+id/TextView02"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignBaseline="@+id/editTextPropertyCalc4"
                    android:layout_alignBottom="@+id/editTextPropertyCalc4"
                    android:layout_alignParentLeft="true"
                    android:text="Mortage Interest Rate% "
                    android:textAppearance="?android:attr/textAppearanceSmallInverse"
                    android:typeface="serif" />

                <TextView
                    android:id="@+id/TextView04"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignBaseline="@+id/editTextPropertyCalc5"
                    android:layout_alignBottom="@+id/editTextPropertyCalc5"
                    android:layout_alignParentLeft="true"
                    android:layout_alignRight="@+id/TextView02"
                    android:text="Monthly Interest"
                    android:textAppearance="?android:attr/textAppearanceSmallInverse"
                    android:typeface="serif" />

                <TextView
                    android:id="@+id/TextView05"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignBaseline="@+id/editTextPropertyCalc6"
                    android:layout_alignBottom="@+id/editTextPropertyCalc6"
                    android:layout_alignParentLeft="true"
                    android:text="Lender&apos;s Rent Cover %"
                    android:textAppearance="?android:attr/textAppearanceSmallInverse"
                    android:typeface="serif" />

                <TextView
                    android:id="@+id/TextView06"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignBaseline="@+id/editTextPropertyCalc7"
                    android:layout_alignBottom="@+id/editTextPropertyCalc7"
                    android:layout_alignParentLeft="true"
                    android:layout_alignRight="@+id/textView3"
                    android:layout_marginBottom="20dp"
                    android:text="Lender&apos;s Monthly Rent Required"
                    android:textAppearance="?android:attr/textAppearanceSmallInverse"
                    android:typeface="serif" />

                <TextView
                    android:id="@+id/TextView07"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignBottom="@+id/editTextPropertyCalc8"
                    android:layout_alignLeft="@+id/TextView06"
                    android:layout_alignRight="@+id/TextView04"
                    android:layout_alignTop="@+id/editTextPropertyCalc8"
                    android:layout_marginTop="15dp"
                    android:text="Montlhly Rent Received"
                    android:textAppearance="?android:attr/textAppearanceSmallInverse"
                    android:typeface="serif" />
                    />

                <EditText
                    android:id="@+id/editTextPropertyCalc9"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignLeft="@+id/editTextPropertyCalc2"
                    android:layout_below="@+id/editTextPropertyCalc2"
                    android:ems="10"
                    android:enabled="false"
                    android:focusable="false"

                    android:focusableInTouchMode="true"
                    android:inputType="numberDecimal" >

                    <requestFocus />
                </EditText>

                <TextView
                    android:id="@+id/textView3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignBaseline="@+id/editTextPropertyCalc2"
                    android:layout_alignBottom="@+id/editTextPropertyCalc2"
                    android:layout_alignLeft="@+id/TextView03"
                    android:gravity="center"
                    android:text="Mortage Loan to value %"
                    android:textAppearance="?android:attr/textAppearanceSmallInverse"
                    android:typeface="serif" />

                <ImageButton
                    android:id="@+id/imageButtonCalcTip1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/editTextPropertyCalc4"
                    android:layout_toRightOf="@+id/TextView06"
                    android:background="#0000"
                    android:padding="10dp"
                    android:scaleType="fitCenter"
                    android:src="@android:drawable/ic_dialog_info" />

                <ImageButton
                    android:id="@+id/ImageButton02"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignBottom="@+id/editTextPropertyCalc7"
                    android:layout_toLeftOf="@+id/editTextPropertyCalc6"
                    android:background="#0000"
                    android:padding="10dp"
                    android:scaleType="fitCenter"
                    android:src="@android:drawable/ic_dialog_info" />

                <ImageButton
                    android:id="@+id/ImageButton01"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_above="@+id/ImageButton02"
                    android:layout_toLeftOf="@+id/editTextPropertyCalc5"
                    android:background="#0000"
                    android:padding="10dp"
                    android:scaleType="fitCenter"
                    android:src="@android:drawable/ic_dialog_info" />
                <ImageButton 
                    android:id="@+id/ImageButton03"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/ImageButton02"
                    android:padding="10dp"
                       android:background="#0000"
                    android:scaleType="fitCenter"
                    android:layout_toLeftOf="@+id/editTextPropertyCalc8"
                    android:src="@android:drawable/ic_dialog_info"/>

            </RelativeLayout>

</ScrollView>

        <LinearLayout
            android:id="@+id/linearLayout3"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
             android:layout_weight="0.60"
            android:background="@drawable/gradient_grey" >

            <LinearLayout
                android:layout_width="81dp"
                android:layout_height="fill_parent"
                android:layout_marginRight="5dp"
                android:orientation="vertical" >

            <ImageButton
                android:id="@+id/imageButtonHome2"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_marginRight="8dp"
                android:src="@drawable/g3570" android:layout_weight="0.6" android:background="#0000" android:scaleType="fitCenter" android:layout_marginTop="5dp"/>

            <TextView                 android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                 android:layout_weight="1"
                 android:text="Home"
                android:gravity="center" android:textAppearance="?android:attr/textAppearanceMediumInverse" android:textColor="#fff" android:textStyle="bold"/>

            </LinearLayout> <LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1" android:orientation="vertical">

            <ImageButton
                android:id="@+id/imageButtonTraining2"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:src="@drawable/g4404" android:layout_weight="0.6" android:scaleType="fitCenter" android:background="#0000" android:layout_marginTop="5dp"/>
                <TextView                
                     android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                 android:layout_weight="1"
                 android:text="Training"
                android:gravity="center" android:textAppearance="?android:attr/textAppearanceMediumInverse" android:textColor="#fff" android:textStyle="bold"/>

            </LinearLayout> 

            <LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1" android:orientation="vertical">

            <ImageButton
                android:id="@+id/imageButtonContactUs2"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:src="@drawable/icon_email" android:layout_weight="0.6" android:scaleType="fitCenter" android:background="#0000" android:layout_marginTop="5dp"/>

               <TextView                 android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                 android:layout_weight="1"
                 android:text="Contact Us"
                android:gravity="center" android:textAppearance="?android:attr/textAppearanceMediumInverse" android:textColor="#fff" android:textStyle="bold"/>

            </LinearLayout>
        </LinearLayout>
    </LinearLayout>

Logcat

01-29 10:57:01.381: D/AndroidRuntime(297): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
01-29 10:57:01.381: D/AndroidRuntime(297): CheckJNI is ON
01-29 10:57:01.521: D/AndroidRuntime(297): --- registering native functions ---
01-29 10:57:02.072: I/ActivityManager(59): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.theappgeeks.kevingreenwealth/.KevinGreenWealthActivity }
01-29 10:57:02.082: D/AndroidRuntime(297): Shutting down VM
01-29 10:57:02.082: D/dalvikvm(297): Debugger has detached; object registry had 1 entries
01-29 10:57:02.102: I/AndroidRuntime(297): NOTE: attach of thread 'Binder Thread #3' failed
  • 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-17T23:33:35+00:00Added an answer on June 17, 2026 at 11:33 pm

    In your XML definition of @+id/editTextPropertyCalc1 change:

    android:enabled="false"
    

    to

    android:enabled="true"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have made some code, but now its to long and i want to
I have some problems with OnTouchListener . I want that everytime when user touch
I have made a code that read data from flash Nand (without filesystem). fd
I'm building an activity stream for our site, and have made some decent headway
In my application, i have made login activity as the main launcher. When user
Some Background The app that i have made, is an interval app. This allows
I have made a dialog which I am happy with. The problem is that
I have made an app that has 3 activities. In the fisrt activity(Import) i
I have made a simple android app,i that some calculations are there from 1
Here is some of the main code for a little app I have made

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.