Android-Customized Dialog
I am new to Android. I want to know how to pass value to the custom开发者_开发问答 dialog box from the activity.
Suppose I want to pass a text in the activity to the edittext box in the customized dialog box,then what should I do?
... somewhere in activity....
private String myValue = "hello :)";
... somewhere in activity when you show dialog...
final View customView = getLayoutInflater().inflate(R.layout.custom, null);
final EditText editTxt = customView.findViewById(R.id.edittext_in_custom_view);
editText.setText(myValue);
new AlertDialog.Builder(this).setView(customView).create().show();
....
精彩评论