I'm having trouble getting an AlertDialog to pass text back to its activity. It seems like the problem is that when findViewByID is called, the correct EditText cannot be found, but I'm new to Android and don't know why this is possible.
Code below:
public class ModifyDialogFragment extends DialogFragment { public interface MDialogListener { public void onMDialogPositiveClick(String newValue); }
And the corresponding modify_dialog.xml file:
<?xml version="1.0" encoding="utf-8"?> <EditText xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/modificationText" android:inputType="text" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:layout_marginLeft="4dp" android:layout_marginRight="4dp" android:layout_marginBottom="4dp"/>
Why is the text editText not found? What can I do to make this work as intended by passing a new line into action?
java android android-edittext android-dialogfragment
Steve schwarcz
source share