android - dialog on dismiss i must update buttons -
i have got litle problem why dismisslistener
doesn't want triggerd, when close dialog. have no idea why. try debug don't know set wrong :) please me
call choosedialog, function won't trigger on dismiss:
cd = new choosedialog(getapplicationcontext()); cd.setondismisslistener(new dialog.ondismisslistener() { @override public void ondismiss(dialoginterface dialog) { // todo auto-generated method stub if (click != -1) { button b = (button) findviewbyid(positionbuttons.click); b.settext(keypadbutton.gettext()); positionbuttons.click = -1; } } });
chosedialog:
package com.calculator.position; import com.calculator.mycalculator.calculator; import com.calculator.mycalculator.calculatorgui; import com.calculator.mycalculator.keypadbutton; import com.calculator.mycalculator.r; import android.app.dialog; import android.content.context; import android.content.dialoginterface; import android.os.bundle; import android.util.log; import android.view.view; import android.widget.button; import android.widget.gridview; public class choosedialog extends dialog { public choosedialog(context context) { super(context); // todo auto-generated constructor stub } keypadadapter mkeypadadapter; gridview mkeypadgrid; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.grid); // reference keypad button gridview mkeypadgrid = (gridview) findviewbyid(r.id.grdbuttons); // create keypad adapter mkeypadadapter = new keypadadapter(getcontext()); // set adapter of keypad grid mkeypadgrid.setadapter(mkeypadadapter); // set button click listener of keypad adapter mkeypadadapter.setonbuttonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { button btn = (button) v; keypadbutton keypadbutton = (keypadbutton) btn.gettag(); log.e(keypadbutton.gettext(), keypadbutton.gettext()); positionbuttons.keypadbutton = keypadbutton; calculatorgui.button.put(positionbuttons.click, keypadbutton); dismiss(); } }); } }
Comments
Post a Comment