Question

My activity's onResume() reads off some "extras" data from the Intent that started it and updates the UI accordingly.

I'd like to add error handling: if the data in the Intent is missing/corrupted, the activity displays a Toast and finishes.

Can I simply call finish() in the onResume() method? I'm worried about some unexpected things given that both are related to the life cycle.

If there are other better ways, I'm interested in these too, but the above seems simplest.

Thanks!

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top