Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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)); }