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 trialZubeyr Aciksari
21,074 PointsHi, can someone show me what to do here? Thanks!
Time for a quick review! Below we are accessing an EditText and a TextView. We have accessed the actual controls, but lets now set the TextView's contents with whatever is in the EditText.
EditText entryField = (EditText)findViewById(R.id.entry_field);
TextView textHolder = (TextView)findViewById(R.id.text_holder);
8 Answers
Ben Wong
19,426 PointsString text = entryField.getText().toString(); textHolder.setText(text);
Kunal Bhuwalka
34,149 PointsWhat you have to do is First obtain the String from your EditText. After that you have to set the text in your TextView with the string you previously obtained. Here is the code implementation: String text = entryField.getText().toString(); //Obtain the string from EditText and store it in text textHolder.setText(text); //Pass the text to TextView
Anthony Attard
43,915 PointsDo it in 1 line
textHolder.setText(entryField.getText().toString());
Zubeyr Aciksari
21,074 PointsHi Kunal, It still doesn't work, i don't know what to do.. Thanks for your help in advance!
Kunal Bhuwalka
34,149 PointsZubeyr, I tried running this code for the challenge you are on and it worked for me. What error are you facing?
Zubeyr Aciksari
21,074 PointsThis pops up when i try the code.. "Bummer! java.lang.NullPointerException (Look around JavaTester.java line 64)"
Kunal Bhuwalka
34,149 PointsPlease copy your entire code here, I will try my best to help although I may not be able to.
Zubeyr Aciksari
21,074 PointsHi Ben, tnx for the help, though i passed this challenge a few days ago :) Thanks anyways..