Android Build an Interactive Story App Intents and Multiple Activities Getting Data from an Intent

Compiler error

error

FlightActivity.java
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;


public class FlightActivity extends AppCompatActivity {

    public int fuelLevel = 0;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_flight);

        // Add your code below!

        Intent intent = getIntent();
        fuelLevel = intent.getIntExtra("FUEL_LEVEL");

    }
}

1 Answer

Zach Freitag
Zach Freitag
18,859 Points

You're super close! You have the first parameter correct, "FUEL_LEVEL" but you are missing the second parameter. The second parameter is the 'defaultValue'.

Code Skeleton: fuelLevel = intent.getIntExtra("FUEL_LEVEL", ___);

What is the 'defaultValue'?

Enter the default value after "FUEL_LEVEL" and you pass!

I would love if you selected this for best answer!

Cheers!