开发者

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();
....
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜