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

Android Build a Self-Destructing Message Android App Adding Users Using Parse.com Logging In

Intent to Main Activity isn't working. when i log in the app crashes. can anybody help me with that?

In the Login Activity

Intent intent=new Intent(LoginActivity.this,MainActivity.class); .... .... startActivity(intent);

similar code in the signup activity too but it fails to reach the main activity.

Sanjiv Saha
Sanjiv Saha
1,110 Points

It gives a ClassCastException..instead of extending FragmentActivity in MainActivity extend ActionBarActivity and make this change in the MainActivity..just paste this code in the in the MainActivity where a very similar code exists:

for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by // the adapter. Also specify this Activity object, which implements // the TabListener interface, as the callback (listener) for when // this tab is selected. actionBar.addTab( actionBar.newTab() .setText(mSectionsPagerAdapter.getPageTitle(i)) //Edited to change from ActionBarActivity to FragmentActivity .setTabListener(this)); }