Reputation: 117
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
Reputation: 2796
You have to call the show
method to display it.
Add this at last
swipeAlert.show();
Upvotes: 0