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

missing content description

When I finally got the phone in the program to test the Crystall Ball app, my phone just said “Unfortunately Crystal Ball has stopped.” There are no errors noted and the only warning I’m finding says “Missing contentDescription attribute on image” Here is what I have -

 <ImageView
        android:id="@+id/imageView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/ball01" />

How do I fix this?

5 Answers

...and now I can't get the code to show up in the post... <ImageView android:id="@+id/imageView1" android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/ball01" />

The forum uses markdown to correctly format code, check out this thread on how to type code in the forum for some examples.

What is line 8 under activity_main supposed to look like? That's the ImageView lines.

So I fixed that 1 warning, so now I have 0 errors and 0 warnings and the app still closes before it starts. Is that the programming or the phone?

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

Glad you got past the warning. Warnings are usually recommendations that won't cause any problems, like in this case. It's best to fix your code to remove all warnings, but not required.

It sounds like something is wrong with your code. What does your output look like in logcat? Usually it gives some kind of exception that helps track down the error. Have you tried debugging and inserting breakpoints (although I think that's later in the project than where you are)?

I'm not sure what was wrong with the code, but everything is working now. I started again from scratch, which I didn't mind. seeing as how I could use the experience. It still gives me the same warning, (Missing contentDescription attribute on image) and has ImageView in the code above underlined in yellow, but I can get past it now and it's working on my phone. Thanks! Onward and upward!