0
我在的onCreate方法創建一個AlertDialog。我希望它僅在該課程的首次發佈中顯示。但問題是,當我改變設備的方向時它會顯示。 我無法使用android:configChanges由於應用程序的體系結構。 是否有任何其他解決方案不顯示AlertDialog當我改變方向? 謝謝。AlertDialog中的onCreate
這裏是我創造我的AlertDialog上的onCreate
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.module);
new AlertDialog.Builder(MyActivity.this).setTitle("Activity")
.setMessage("Alert?")
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// do something
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// do nothing
}
})
.show();
}
}
你能告訴你的代碼? – Raptor
這是第一次在應用程序上使用或每次啓動應用程序時只使用一次? – edwoollard
每次我啓動應用程序 – tchike