2

I have following app. I am trying to do a very simple thing . Just show alert when it starts . But it just shows this message

"[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"

On emulator I see just project name and blank screen . Am I missing anything ? Any directions appreciated .

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();

    }
}
4

2 回答 2

5

You are actualy not showing your dialog.

alert.show();
于 2012-04-13T21:44:57.467 回答
1

The message you get is just telling you that there is nothing new to compile, you are already running the latest version, which is now displayed on your device.

于 2012-04-13T21:45:21.633 回答