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 trialma ali
Courses Plus Student 2,788 Pointsi have problem i stick here
what is the answer
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class LaunchActivity extends Activity {
public Button mLaunchButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_launch);
mLaunchButton = (Button)findViewById(R.id.launchButton);
mLaunchButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Add your code in here!
}
});
}
}
1 Answer
Doug Ray
7,493 PointsCorrect the problem is asking you to create a new intent like this Intent intent = new Intent(LaunchActivity.this, FlightActivity.class); and start it with the startActivty(intent); command.
Daniel Hair
5,080 PointsDaniel Hair
5,080 PointsThis answer is asking about the intent right?
Its asking to "intent" to launch another activity (through a class) from this current class. Here is the answer to put under "//add your code in here".
"Intent intent = new Intent(LaunchActivity.this, FlightActivity.class);" This creates a new Intent object that can allow the LaunchActivity to run within the FlightActivity class. In the video example, they said that after this declaration, you can put this code "startActivity(intent);" and it will launch that Activity. However, that is just for example. You only need that first line starting with "Intent intent..."