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 Starting the App Navigation with Back and Up

Rakeem Williamson
Rakeem Williamson
7,163 Points

Cant figure out step 2 on this challenge

What am i doing wrong

CodeChallengeActivity.java
import android.app.Activity;
import android.content.Intent;

public class CodeChallengeActivity extends Activity {
Intent intent = new Intent(this, CommentActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
    // Some code has been omitted

    public void addComment() {

    }
}

1 Answer

Harry James
Harry James
14,780 Points

Hey Rakeem!

That's the right code! You've just written it in the wrong place!

Move all of the Intent code into the addComment() method and the challenge will pass :)


Hope it helps and happy coding ;)