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

MessageAdapter

i want to display images instead of texts in my adapter

\\holder.nameLabel.setText(musics.getString(ParseConstants.KEY_GENRE));\\

what should i use in my .set stuff since i can't use .setImageResource please...

Yan He
Yan He
1,314 Points

The .setImageResource works for me based on that the drawable image (i.e. ic_action_picture.png) is stored under drawable-hdpi, drawable-mdpi and drawable-xhdpi folders. The associated line of the code is as follows:

holder.iconImageView.setImageResource(R.drawable.ic_action_picture);

2 Answers

i want to reference it to my image file at parse.com

Yan He
Yan He
1,314 Points

First download picasso-2.4.0.jar from http://square.github.io/picasso/ and copy it onto libs of your project. Then add the lines of code as follows:

ParseObject message = mMessages.get(position); // The position is the row index of the Message table for your image in Parse. The mMessages is data source member that is set from the MessageAdapter constructor.

ParseFile file = message.getParseFile("file"); // The "file" is assumed the column name of your Message table for stored images

imageUrl = Uri.parse(file.getUrl());

Picasso.with(this).load(imageUri.toString()).into(holder.iconImageView);

thanks alot......worked great