android - My activity closes down when i cancel or accept bluetooth enable request? -
there no error in logcat current activity closes down , previous activity opens.
here code puttin bluetooth enabling request:
bt.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { if (!(bluetooth.isenabled())) { log.e("blue",""+"not working"); status = "bluetooth not enabled."; toast.maketext(adduser.this, status, toast.length_short).show(); intent enablebtintent = new intent(bluetoothadapter.action_request_enable); startactivityforresult(enablebtintent, 1); } else { scand(); } } });
here onactivityresult:
protected void onactivityresult(int requestcode, int resultcode, intent intent) { system.out.println(resultcode); log.e("resultblue",""+resultcode); if (resultcode == result_canceled) { runonuithread(new runnable() { public void run() { toast.maketext(adduser.this, "error enabling bluetooth", toast.length_long).show(); } }); } else { scand(); } }
what problem?
Comments
Post a Comment