When I return back to my Activity onCreate is raised instead of onActivityResult?
Asked Answered
K

2

1

I have an Activity that opens a new Activity for result like this:

Intent i = new Intent(ActDocument.this, ActCustomers.class);
startActivityForResult(i, ActDocument.DIALOG_CUSTOMER);

when I press back in the child Activity and return back to the parent Activity onActivityResult is called in all of devices correctly but I have fount a device that onCreate is called instead of onActivityResult.

This device is Samsung Galaxy Tab-P5100 Android 4.0.3. It is strange that I have tested my application on other devices of Samsung Galaxy Tab-P5100 Android 4.0.3 and it was OK but I have problem only in this device.

Why? How can I solve that?

Update

I noticed onDestroy() of parent Activity is called after opening child Activity on this device.

Kakemono answered 7/1, 2013 at 12:9 Comment(0)
M
8

most of the time Back button will finish the activity unless you specific override the

OnBackPressed()

I think your problem is lack of resources, or maybe you have some developer options like kill activty flag or limit background process check this.

Update

Go to setting-> developer options unchecked don't keep activities and background process limit set to standard limit.

Mileage answered 7/1, 2013 at 12:20 Comment(4)
How can I check? Why it is OK in all devices except on device?Kakemono
I noticed onDestroy() of parent Activity is called after opening child Activity on this device.Kakemono
go to setting-> developer options unchecked don't keep activities and background process limit set to standart limitMileage
Yeah ..Thanks a lot!! This solved my issue too !!! But how can we detect if user has checked this option in his/her device.??Currycomb
D
0

Perhaps the back button doesn't finish the Acivity. So, override onBackPressed.

Delightful answered 7/1, 2013 at 12:11 Comment(7)
I tested. Nothing changed :(Kakemono
@breceivemail sorry. I misread your code. I updated my answer.Delightful
I am doing this. I override onBackPressed. I think it is not related to my questionKakemono
Hm. Only one device. Perhaps there are some memory issues. Is the device running a lot of other apps?Delightful
The only thing I can think of, is that Android kills the ActDocument activity for whatever reason while in ActCustomers activity. Other than that, no idea why it doesn't work.Delightful
I noticed onDestroy() of parent Activity is called after opening child Activity on this device.Kakemono
let us continue this discussion in chatDelightful

© 2022 - 2024 — McMap. All rights reserved.