android - How to get the edit text value out of the Anonymos class -


i creating alertdialog inputting data , want take out anonymous class created alertdialog. here have:

    public void setdescriptiondialog() {     alertdialog.builder alert = new alertdialog.builder(this);      alert.settitle("title");     alert.setmessage("message");      // set edittext view user input     final edittext input = new edittext(this);     view v = input;     alert.setview(input);     alert.setpositivebutton("ok", new dialoginterface.onclicklistener() {         public void onclick(dialoginterface dialog, int whichbutton) {             editable value = input.gettext();             out = value.tostring();             log.i("input + ", value.tostring());             // value!         }     });      alert.setnegativebutton("cancel",             new dialoginterface.onclicklistener() {                 public void onclick(dialoginterface dialog, int whichbutton) {                     // canceled.                 }             });      alert.show(); } 

out global variable of type string.

in onclick() of dialog send method need to

out = value.tostring(); log.i("input + ", value.tostring()); // value! useoutput(out); 

then somewhere in activity create method , put code uses in there

private void useoutput(string soutput) {     // value } 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -