我做了一个我很满意的对话。问题是我希望用数据库中的信息打开对话框。现在完成了对话框的布局。但对于一件事,某种类型的字段框将调用数据。我不知道我需要输入到要显示的布局中。
任何帮助都很棒。谢谢
public class activity2 extends Activity {
/** Called when the activity is first created. */
Dialog Dialog;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main2);
Dialog = new Dialog(this);
Dialog.setContentView(R.layout.main3);
Dialog.setTitle("ProJect69");
Dialog.setCancelable(true);
TextView btn1 =(TextView) findViewById(R.id.textView4);
btn1.setOnClickListener(new OnClickListener (){
public void onBackpressed(){
Intent intent= new Intent(activity2.this,activity2.class);
startActivity(intent);
finish();
}
public void onClick(View v){
Dialog.show();
}
});
}
}
答案 0 :(得分:0)
Dialog dlg;
...
((TextView) dlg.findViewByID(R.id.textView1)).setText("your text");