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 trialmaxmaltsev
3,419 PointsExtra Credit - Array Madness
Hi,
So i was trying to do an Extra Credit Task in Array Madness training at Android development section:
"Create a new project and add two TextViews to the screen. Create an array of numbers and see if you can display the numbers in order in the first TextView and then reversed in the second TextView."
What I'm I doing wrong? How make array numbers in order and reversed after?
```JAVA
setContentView(R.layout.activity_array);
TextView firstLabel = (TextView) findViewById(R.id.textView);//textview1
TextView secondLabel = (TextView) findViewById(R.id.textView2);//textview2
int myNumbers[] = {1,4,5,7,2,9,11,6,28,13}; // This is an array
Arrays.sort(myNumbers); // Trying to sort it
int firstTextView = myNumbers; // Wrong data type :(
firstLabel.setText(firstTextView);
```
aakarshrestha
6,509 Pointsaakarshrestha
6,509 PointsYou are missing index in the array you are using i.e. "firstLabel.setText(firstTextView[provide the index here]);"
Hope it clears your confusion.
Happy coding!