I need a edit text dialog when I use Jetpack Compose in my project.
The Code A is from the article.
Q1: I don't know if Code A can use in Jetpack Compose, could you tell me?
I was told that Dialogs are available in the Material library for Jetpack Compose
It seems that Material library only provide Alert dialog, Simple dialog and Confirmation dialog.
Q2: Does Material Components provide edit text dialog when I use Jetpack Compose?
Code A
AlertDialog.Builder alert = new AlertDialog.Builder(this);
final EditText edittext = new EditText(ActivityContext);
alert.setMessage("Enter Your Message");
alert.setTitle("Enter Your Title");
alert.setView(edittext);
alert.setPositiveButton("Yes Option", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
//What ever you want to do with the value
Editable YouEditTextValue = edittext.getText();
//OR
String YouEditTextValue = edittext.getText().toString();
}
});
alert.setNegativeButton("No Option", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// what ever you want to do with No option.
}
});
alert.show();