2012-04-13 75 views
2

我有以下應用程序。我正在嘗試做一件非常簡單的事情。只需在啓動時顯示警報。但它只是顯示這個消息平凡的Android應用程序中的對話框不顯示?

"[2012-04-13 17:38:23 - HelloDriod] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=hellodriod.hello/.HelloDriodActivity } 
[2012-04-13 17:38:23 - HelloDriod] ActivityManager: Warning: Activity not started, its current task has been brought to the front" 

在模擬器我看到的只是項目的名稱和空白屏幕。我錯過了什麼?任何方向讚賞。

package hellodriod.hello; 


import android.app.Activity; 
import android.app.AlertDialog; 
import android.content.DialogInterface; 
import android.os.Bundle; 



public class HelloDriodActivity extends Activity { 
    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     AlertDialog.Builder builder = new AlertDialog.Builder(this); 
     builder.setMessage("Are you sure you want to exit?") 
       .setCancelable(false) 
       .setPositiveButton("Yes", new DialogInterface.OnClickListener() { 
        public void onClick(DialogInterface dialog, int id) { 

        } 
       }) 
       .setNegativeButton("No", new DialogInterface.OnClickListener() { 
        public void onClick(DialogInterface dialog, int id) { 
         dialog.cancel(); 
        } 
       }); 
     AlertDialog alert = builder.create(); 

    } 
} 

回答

5

你真的沒有顯示你的對話框。

alert.show(); 
1

你得到的只是告訴你,沒有什麼新編譯的消息,您已經在運行最新版本,其現在顯示設備上。

相關問題