Android Build an Interactive Story App Finishing the User Interface Using a Model in the Presenter

Caleb Seeling
Caleb Seeling
1,189 Points

I still can't get to solve this question.

I asked already before how to solve this and I got a clue from a user but I still can't solve it.
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class LandingActivity extends AppCompatActivity {

    public Button thrustButton;
    public TextView typeLabel;
    public EditText passengersField;

    public Spaceship spaceship;

    public void onCreate(Bundle savedInstanceState) {

        thrustButton = (Button)findViewById(;
        typeLabel = (TextView)findViewById(;
        passengersField = (EditText)findViewById(;

public class Spaceship {
    private String shipType;
    private int numPassengers = 0;

    public String getShipType() {
      return shipType;

    public void setShipType(String shipType) {
      this.shipType = shipType;

    public int getNumPassengers() {
      return numPassengers;

    public void setNumPassengers(int numPassengers) {
      this.numPassengers = numPassengers;

    public Spaceship() {
      shipType = "SHUTTLE";

    public Spaceship(String shipType) {
      this.shipType = shipType;

1 Answer

Hi Caleb,

The first task wants you to set the existing spaceship variable to be a new instance of Spaceship. The question wants us to pass the value "FIREFLY" into that new instance.

So, where the challenge says "add you code here" start with the existing variable name, then put an equals sign. That means we're going to assign something into the variable. We want to assign a new spaceship, so type that, new Spaceship and pass in the string that the challenge says, "FIREFLY".

That all looks like:

spaceship = new Spaceship("FIREFLY");

What we're doing here is calling the constructor of the Spaceship class (it has 2 but let's not worry about that!). The constructor constructs a new Spaceship and calls that ship whatever name you pass in. So, now you have a shiny new FIREFLY type spaceship ready to do whatever the next task wants you to do!

Let me know how you get on.