android - How to add Alertdialog and link to the button on activity? -


what rely want add alertdialog in android app, want when it's being clicked on popup @ least 10messages. popup message in javascript.

here how add alert dialog in app

sharedpreferences mprefs; final string welcomescreenshownpref = "welcomescreenshown";  /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.main);      mprefs = preferencemanager.getdefaultsharedpreferences(this);      // second argument default use if preference can't found     boolean welcomescreenshown = mprefs.getboolean(welcomescreenshownpref, false);      if (!welcomescreenshown) {         // here can launch activity if         // code below display popup          string whatsnewtitle = getresources().getstring(r.string.whatsnewtitle);         string whatsnewtext = getresources().getstring(r.string.whatsnewtext);         new alertdialog.builder(this).seticon(android.r.drawable.ic_dialog_alert).settitle(whatsnewtitle).setmessage(whatsnewtext).setpositivebutton(                 r.string.ok, new dialoginterface.onclicklistener() {                     public void onclick(dialoginterface dialog, int which) {                         dialog.dismiss();                     }                 }).show();         sharedpreferences.editor editor = mprefs.edit();         editor.putboolean(welcomescreenshownpref, true);         editor.commit(); // important save preference     }  } 

Comments