yologaming
yologaming

Reputation: 117

How to display dialog upon launching Android app

How do you display a dialog box upon launching android application.

Here is my code:

AlertDialog.Builder swipeAlert;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    swipeAlert = new AlertDialog.Builder(this);
    swipeAlert.setMessage("Swipe to see map");
    swipeAlert.setPositiveButton("OK",null);

But when I launch my android app, nothing displays. How come?

Upvotes: 0

Views: 62

Answers (2)

harishannam
harishannam

Reputation: 2796

You have to call the show method to display it.

Add this at last

swipeAlert.show(); 

Upvotes: 0

user4205830
user4205830

Reputation:

you need to add

swipeAlert.show();

Upvotes: 1

Related Questions