I\'m starting a new Activity from my Fragment with
startActivityForResult(intent, 1);
and want to handle the result in the Fragment\'s pare
Easier:
Java:
int unmaskedRequestCode = requestCode & 0x0000ffff
Kotlin:
val unmaskedRequestCode = requestCode and 0x0000ffff
Check for the lower 16 bits, just unmask it doing a logical AND with the upper 16 bits zeroed
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
final int unmaskedRequestCode = requestCode & 0x0000ffff
if(unmaskedRequestCode == ORIGINAL_REQUEST_CODE){
//Do stuff
}
}