2

There is no error in the logcat just the current activity closes down and previous activity opens.

Here is the code where am puttin bluetooth enabling request:

 bt.setOnClickListener(new OnClickListener() {
           @Override
           public void onClick(View v) {
               if (!(bluetooth.isEnabled())) {
                   Log.e("blue",""+"not working");
                   status = "Bluetooth is 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 is 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 could be the problem?

DoYou EvenLift
  • 319
  • 3
  • 7
  • 16
  • does you have any log entries from the bluethoot intent reciever? Are you developing on emultor? – MemLeak May 02 '13 at 10:36
  • 2
    I just found out that i had nohistory enabled for the activity in the manifest file. so when i was starting the startactivity for result, te current activity was being destroyed. i am such a fool. :'(. That was the real problem right? – DoYou EvenLift May 02 '13 at 10:41
  • thank you for asking this. You just saved me a lot of time. I am just as much a fool :) – Bram Jul 28 '16 at 08:21

0 Answers0