2011-01-20 8 views
0

Androidが新機能です。アクティビティからカスタムダイアログボックスに値を渡す方法を知りたい。Android-Customized Dialog

アクティビティのテキストをカスタマイズしたダイアログボックスのedittextボックスに渡したいとしたら、どうすればよいですか?

+0

あなたが現在(あなたのダイアログを作成する場合) –

+0

は、[質問](http://stackoverflow.com/questions/4745651/bundle-names-annoying-issue)これを、このを見て持っているコードを表示しますあなたの答えかもしれない – ingsaurabh

答えて

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