1
我創建了一個對話框,像這樣使用自定義佈局:對話情境問題 - Android電子
dialog = new Dialog(FetchMenu.this, R.style.CustomDialogTheme);
dialog.setContentView(R.layout.custom_dialog_iab);
dialog.show();
現在我想「layout.custom_dialog_iab」中編輯的文本框,例如:
TextView text = (TextView) findViewById(R.id.all_topics_unlock_button);
text.setText("Purchased");
我的問題:如何獲得正確的上下文以編輯文本框?
P.S.我已經嘗試'dialog.getContext()',但仍然保持拋出空指針?
你有沒有嘗試過'TextView text =(TextView)對話框。 findViewById(R.id.all_topics_unlock_button);'顯示對話框後? – 2013-05-09 19:15:17