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

Compiler error

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

public class FlightActivity extends AppCompatActivity {

    public int fuelLevel = 0;

    protected void onCreate(Bundle savedInstanceState) {

        // Add your code below!

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


1 Answer

Zach Freitag
Zach Freitag
19,026 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!