i've tried textEntryView.getText()
but it asks me to typecast the textEntryView to EditText
when i do so, i get a java.lang.ClassCastException
here's the code m working with
Using java Syntax Highlighting
- protected Dialog onCreateDialog(int id)
- {
- LayoutInflater infalter = LayoutInflater.from(this);
- final View textEntryView = infalter.inflate(R.layout.alert_dialog_text_entry, null);
- AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
- dialogBuilder.setTitle("Edit Free Text");
- dialogBuilder.setView(textEntryView);
- dialogBuilder.setPositiveButton("Save", new OnClickListener(){
- @Override
- public void onClick(DialogInterface dialog, int which)
- {
- CharSequence text = ((EditText) textEntryView).getText();
- mFreeTxtView.setText(text);
- }
- });
- dialogBuilder.setNegativeButton("Cancel", null);
- return dialogBuilder.create();
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
}
and here's the alert_dialog_text_entry.xml file
Using xml Syntax Highlighting
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical">
- <EditText
- android:id="@+id/ALERT_DIALOG_EDIT_TEXT"
- android:layout_height="100px"
- android:layout_width="fill_parent"
- android:layout_marginLeft="20dip"
- android:layout_marginRight="20dip"
- android:maxHeight="100px"
- android:gravity="top|left"
- />
- </LinearLayout>
Parsed in 0.002 seconds, using GeSHi 1.0.8.4
can anybody please tell me how to get the text from the EditText when user clicks on Save...????
please help me out...

