You change the requestCode that you use when calling startActivityForResult .
EDIT: for example, I use this:
startActivityForResult(i, App.REQUEST_ENABLE_BT);
and this:
startActivityForResult(i, App.MANUAL_INPUT);
and then you filter the results as follows:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(resultCode == RESULT_OK){ switch(requestCode){ case App.REQUEST_ENABLE_BT: if(resultCode != RESULT_OK){ Toast.makeText(this, getString(R.string.label_bluetooth_disabled), Toast.LENGTH_LONG).show(); } break; case App.MANUAL_INPUT: break; } }
source share