我有以下应用。我想做一件非常简单的事情。只需在启动时显示警报。但它只是显示了这条消息
"[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();
}
}
答案 0 :(得分:5)
您实际上没有显示对话框。
alert.show();
答案 1 :(得分:1)
您收到的消息只是告诉您编译没有新内容,您已经在运行最新版本,该版本现已显示在您的设备上。