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 Build a Self-Destructing Message Android App Retrieving and Viewing Messages Creating a Custom List Adapter for Messages

Wayne Wong
Wayne Wong
1,567 Points

Custom List Adapter being called multiple times

I tried debugging the program, so I think I've narrowed it down. The problem is in MessageAdapter, under the condition that checks if the fileType equals image or view. My app kept crashing there. I put in Log.v to trace what went wrong as the different code blocks were being run.

It seems like the getView block kept being call again and again. When that happens, message.getString(ParseConstants.KEY_FILE_TYPE sometimes returns a null for some reason. I think that's why the debugger points to the condition checking fileType fails, whenever the app crashes.

Hi Wayne,

I recommend that you add supporting info to your question as comments to your question and not as answers. As it stands right now this question is showing up on the main page as having 2 answers and some people may skip it thinking it's already been solved.

You can move that info to the comments here and delete your answers if you want to.

Wayne Wong
Wayne Wong
1,567 Points

Thanks Jason. No worries. I think I have resolved the issue...