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!
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

Jery Althaf
5,818 PointsmSpaceship.Spaceship(mSpaceship.Spaceship("FIREFLY"); doesn't work ? Can any one help
The LandingActivity interacts with the Spaceship model object we created. Start by setting mSpaceship to a new Spaceship object in the onCreate() method. Use the custom constructor that takes a String parameter, and pass in "FIREFLY" as the parameter.
2 Answers
Jack Middlebrook
19,746 PointsThe code given to you in this Code Challenge only creates the variable mSpaceship that can hold an object of type Spaceship. In the first step you need to assign mSpaceship to a new Spaceship object. If you click to the Spaceship.java tab you can see that there is a constructor that you can pass a String to as follows:
public Spaceship(String type) {
mType = type;
}
Knowing this you can set mSpaceship to a new Spaceship object as follows:
mSpaceship = new Spaceship("FIREFLY");
where the String passed in the constructor is "FIREFLY".

MUZ140132 Kudakwashe Garaba
2,125 Pointsimport android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText;
public class LandingActivity extends Activity {
public Button mThrustButton;
public TextView mTypeLabel;
public EditText mPassengersField;
public Spaceship mSpaceship;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_landing);
mThrustButton = (Button)findViewById(R.id.thrustButton);
mTypeLabel = (TextView)findViewById(R.id.typeTextView);
mPassengersField = (EditText)findViewById(R.id.passengersEditText);
// Add your code here!
mSpaceship = new Spaceship("FIREFLY");
}
}

TheBigoso /\
3,217 PointsRock Star!!!