It seems that whenever I press the back button on CropImageActivity, my app just crashes.
Is there a way to customize the back button (Top left on the UI page), so that I can take it back to my original activity,
Did you fix the problem? I ask because I have the same problem:(
@ArthurHub Can you help us please?:(
@cgupta3131 ?
Hey! I tried but was in vain!!
@cgupta3131 I already fix the problem:
In the onActivityResult() method we have a variable called data, which stores the image we choose to crop. Therefore, if we press the back button, data will become null (because we did not choose an image), causing the line _val: CropImage.ActivityResult = CropImage.getActivityResult (data) _ to fail.
This were the changes that I implemented to make to my code work:
if(requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE && data != null){
// Store image in the firebase storage and database logic
} else { // data is null, go back to the setup activity
val selfIntent = Intent(this@SetupActivity,SetupActivity::class.java)
selfIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
startActivity(selfIntent)
}
Thank you @oescob16 this just helped me big time
The issue is fixed, view the last comment for more details
Most helpful comment
@cgupta3131 I already fix the problem:
In the onActivityResult() method we have a variable called data, which stores the image we choose to crop. Therefore, if we press the back button, data will become null (because we did not choose an image), causing the line _val: CropImage.ActivityResult = CropImage.getActivityResult (data) _ to fail.
This were the changes that I implemented to make to my code work:
if(requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE && data != null){
// Store image in the firebase storage and database logic
} else { // data is null, go back to the setup activity
val selfIntent = Intent(this@SetupActivity,SetupActivity::class.java)
selfIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
startActivity(selfIntent)
}