Hello all,
I am facing some not understandable error. Could anybody help to put
light on it....
The variable edtTxt is returning null and encoutering nullpointer
exception while I am trying to run and entered text in the txt_edit
field.

Here is the code.
------------------------------ code ------
AlertSample.java
-----------------------
                       LayoutInflater factory = LayoutInflater.from
(this);
                        final View txtEntryview = factory.inflate
(R.layout.sample_alert_edit,null);
return new AlertDialog.Builder(AlertSample.this)
                                .setIcon(android.R.drawable.ic_dialog_alert)
                                .setTitle("Enter Name")
                                .setView(txtEntryview)
                                .setPositiveButton("OK", new 
DialogInterface.OnClickListener()
{
                        public void onClick(DialogInterface dialog,
int whichButton) {
                                EditText edtxt =  (EditText) findViewById
(R.id.txt_edit);
                                Editable strTxtforSearch =
edtxt.getEditableText();
                                getWorkDone(strTxtforSearch.toString());
                        }
                    })

-------sample_alert_edit.xml------------
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <TextView
        android:id="@+id/txtID"  android:layout_height="wrap_content"
        android:layout_width="wrap_content"
android:layout_marginLeft="20dip"
        android:layout_marginRight="20dip" android:text="Enter
Location to Search:"
        android:gravity="left"  android:textAppearance="?android:attr/
textAppearanceMedium" />

    <EditText android:id="@+id/txt_edit"
        android:layout_height="wrap_content"
android:layout_width="fill_parent"
        android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
        android:scrollHorizontally="true"  android:capitalize="none"
android:gravity="fill_horizontal" />
</LinearLayout>

Any response is appreciable.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to