android back button doesn't close my dialog -
i have activity layout. open dialog it. when click button, doesn't work , don't close , activity.
i know can solve overriding onkeydown() method, want know why problem occurred.
about 2 days ago, worked , haven't problem it. want know how solve problem?
here dialog class code:
package digitaldreams.ddvolume; import android.app.dialog; import android.content.context; import android.media.audiomanager; import android.os.bundle; public class dialogvolume extends dialog { context cont; public dialogvolume(context context) { super(context); cont=context; // todo auto-generated constructor stub } @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); . . . } @override public boolean onkeydown(int keycode, keyevent event) { //****** super.onkeyup(keycode, event); ***** if forget line . . . return super.onkeydown(keycode, event); }
it simple app control volumes of android.
and activity, call dialog simple layout.
edit:
i myself solve it! forget call super class of onkeyup() function in overrided method silly problem
thank all
setcancelable(true)
should work
http://developer.android.com/reference/android/app/dialog.html#setcancelable(boolean)
public void setcancelable (boolean flag)
added in api level 1 sets whether dialog cancelable key.
Comments
Post a Comment