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 trialNiravkumar Patel
2,277 Pointsnot able to setText for titleTextView in a task
public View getView(int position, View convertView, ViewGroup parent) {
// some code omitted
Book book = mBooks[position];
holder.titleTextView.setText(book.getTitle(mBooks));
}
where I have made mistake can anyone help me figure that out?
1 Answer
Steve Hunter
57,712 PointsI can't find the challenge you're trying to do but I think there may be an issue in your second line.
You're asking to getText
from the array mBooks
. I think you want to use the Book
object, book
that you created using mBooks[position]
. I think you can just say book.getTitle()
as that will return the property - there's no need to pass it a parameter?
So that line would look like:
holder.titleTextView.setText(book.getTitle());
(I'm not clear where holder
comes from or what it is - I'm assuming it is part of the View
)
Which challenge/task are you doing? I'll see if I can help out when I can see that.
Steve.