Android onActivityResult is Deprecated.
But I am trying to build an App in Java with a button which will give two option to select photo , either through gallery or through Camera. In onActivityResult, it used to have request codes. So earlier we can get two different request codes for camera and gallery and according using if statement we can handle them using onActivityResult. Now how should we implement it ?
Below is the older way which I mentioned:
''''
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == CAPTURE_IMAGE){
if(resultCode == RESULT_OK){
if(mImageUri != null){
//REST OF CODE
}
}
}
if(requestCode == GALLARY_PICK){
if(resultCode == RESULT_OK){
Uri uri = data.getData();
if(uri != null) {
//REST OF CODE
}
}
}
}
''''