Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


How to navigate to another activity without errors


When i do something in empty activity and when i navigate from one empty activity to another through back sign , then the app crashes , but if i do the same thing using blank activity it works fine ?

Ben Deitch
Ben Deitch
Treehouse Teacher

Please post your error as it appears in the Android Monitor.

David Aryeetey
David Aryeetey
6,258 Points

Hmmn I would need to know more. Nevertheless, the safe and smart way to start an activity is to use this bit of logic that let's you only start an activity if the appropriate activity exists:

if( intent.resolveActivity(getPackageManager())!= null ){ startActivity(intent); } Now in regards to the back button I would need to know more. However one thing you could do is check your android manifest file and see if for your activity element the appropriate parent_activity attribute value has been set. That parent activity is the original screen that when you press the back button it would go back to.