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 trial

Android

Jerome Heaven
Jerome Heaven
8,641 Points

My code in android studio is showing that the fields are not assigned(with yellow warning) when it is below.

package com.heavenmedia.interactivestorybook.Ui;

import android.content.Intent; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView;

import com.heavenmedia.interactivestorybook.R; import com.heavenmedia.interactivestorybook.model.Page; import com.heavenmedia.interactivestorybook.model.Story;

public class StoryActivity extends AppCompatActivity {

public static final String TAG = StoryActivity.class.getSimpleName();

private Story story;

//These values below

private ImageView storyImageView;
private TextView storyTextView;
private Button choice1Button;
private Button choice2Button;

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

//Where they're assigned

    storyImageView = (ImageView)findViewById(R.id.storyImageView);
    storyTextView = (TextView)findViewById(R.id.storyTextView);
    choice1Button = (Button)findViewById(R.id.choice1Button);
    choice2Button = (Button)findViewById(R.id.choice2Button);

    Intent intent = getIntent();
    String name = intent.getStringExtra(getString(R.string.key_name));
    if (name == null || name.isEmpty()) {
        name = "Friend";
    }
    Log.d(TAG, name);

    story = new Story();
    loadPage(0);
}

private void loadPage(int pageNumber) {