android - Cannot display a alert inside onNewIntent() -


i have problem displaying alert inside onnewintent(intent intent) function. pending intent retrieved correctly , it's value logged expected, alert isn't displayed.

@override protected void onnewintent(intent intent) {     super.onnewintent(intent);      bundle extras = getintent().getextras();     if(extras !=null) {         string value = extras.getstring("message");         log.v("alert", value);  // <--- line works fine.           alertdialog alertdialog = new alertdialog.builder(this).create();         alertdialog.settitle("title");         alertdialog.setmessage(value);         alertdialog.setbutton(alertdialog.button_positive, "ok", new dialoginterface.onclicklistener() {              public void onclick(dialoginterface dialog, int which) {               }         });          alertdialog.show();     } } 

try this:

alertdialog alertdialog = new alertdialog.builder(youractivity.this).create(); 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -