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 trialJacob Stroyny
Courses Plus Student 1,225 PointsThe value "Friend" assigned to 'name' is never used.
How do i fix?
1 Answer
Jon Kussmann
Courses Plus Student 7,254 PointsHello,
Your IDE (I'm assuming Android Studio) is just letting you know that you assign the value "Friend" to the variable name, but you don't use it anywhere... you aren't setting it in a TextView, using it in a method, etc. This is not an error. It's just a nice little message to let you know that you have a variable that you are not yet using. Later on when you do something with the 'name' variable, that message will go away.
As a side note in your Log statement.. it should be:
Log.d(TAG, name);
Jacob Stroyny
Courses Plus Student 1,225 Pointsthanks
Jacob Stroyny
Courses Plus Student 1,225 PointsJacob Stroyny
Courses Plus Student 1,225 Pointspackage com.example.jacob.interactivestory;
import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem;
public class StoryActivity extends Activity {
}
//the second name in the if line shows gray