eclipse - android - Scala OnClickListener AlertDialog -


i create alertdialog android in scala ide plugin eclips, want change activity after clicking on no button couldn't change it, don't have error!!

would please give me hints, if wrote wrong

thanks in advance! first android app in scala

 new alertdialog.builder(this)                 .settitle("exit camera")                 .setmessage("do want try again?")                 .setpositivebutton("no", new view.onclicklistener {                     println("nooooo print")                     def onclick(dialog: view) {                         println("no print");                         val intent = new intent(claimbookactivity.this,     classof[homeactivity]);                         startactivity(intent);                          println("no class");                     }                 })                 .setnegativebutton("yes", new view.onclicklistener {                     println("yes print")                     def onclick(dialog: view) {                         println("test")                     }                 }).show() 

i rewrote yor code little bit , starts second activity well:

new alertdialog.builder(this)   .settitle("exit camera")   .setmessage("do want try again?")   .setpositivebutton("no",     () => {       println("no print")       val intent = new intent(mainactivity.this,         classof[notmainactivity])       startactivity(intent)       println("no class")     })   .setnegativebutton("yes",     () => {       println("yes print")       println("test")     }).show() 

add code somewhere else

implicit def func2onclicklistenerdialog(func: () => unit): dialoginterface.onclicklistener = {     new onclicklistener() {       override def onclick(dialog: dialoginterface , which: int) = func()     } } 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -