ich die Schaffung nächste AlerDialog zu bekommen:Wie EditText von Fragment
AlertDialog.Builder alert = new AlertDialog.Builder(appContext);
alert.setTitle("Add subcontractors").setView(R.layout.add_subcontractor_form);
//final EditText input = new EditText(appContext);
alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
String YouEditTextValue = input.getText().toString();
}
});
alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// what ever you want to do with No option.
}
});
alert.show();
Und haben neben Layout für sie:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<EditText
android:layout_margin="10dp"
android:id="@+id/et_sub_name"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="Type name here"
android:textSize="20sp"/>
</LinearLayout>
Meine Frage ist, wie EditText Blick aus meinem Layout in Code zu bekommen? Weil ich einen eingegebenen Text haben möchte, nachdem der Benutzer die "OK" Taste gedrückt hat.
Große, es funktioniert für mich. Vielen Dank – neustart47