私はthe Android tutorialを非常によく辿ったと思います。私はある時点でshowDialog(DIALOG_EXPORT);
を呼び出すListActivity
を持っています。私のonCreateDialog()
は、ダイアログを作成し、XMLビューを設定し、そのダイアログの要素で何かをしようとしますが、findViewById()
の直後はすべてnull
です。どうして?Android:ダイアログを作成する
ここでコード:
protected Dialog onCreateDialog(int id) {
switch(id){
case DIALOG_EXPORT:
final Dialog dial = new Dialog(this);
dial.setContentView(R.layout.export_dialog);
dial.setTitle(R.string.dialog_export_title);
EditText eFile = (EditText) findViewById(R.id.e_dialog_export);
Button bOkay = (Button) findViewById(R.id.b_export_okay);
Button bCancel = (Button) findViewById(R.id.b_export_cancel);
<here all View elements are empty>
...
return dial;
...
}
}
すべてが有効です。レイアウトXMLを貼り付けてください。 –