tags:

views:

17

answers:

2

In Android 1.6 and higher, this menu XML inflates and runs fine. But when run in 1.5 I get an error about a resource not found.

I find that when I remove the @drawable/menu_preferences from the XML in 1.5 it works fine.

Is there a 1.5 work around I can do to get the image to work?

EDIT: The image is in the drawable-mdpi folder.

<menu xmlns:android="http://schemas.android.com/apk/res/android"&gt;
    <item 
        android:id="@+id/menu_settings"
        android:title="@string/settings"
        android:icon="@drawable/menu_preferences" />
</menu>
+1  A: 

What does the eclipse completion says to you when you type "@drawable/men" ? Did you refresh your eclipse project after adding your image ? What is the image format?

fedj
It auto completes correctly, the image is a png. I cleaned the project, and deleted the R class to ensure we're clear. It works fine in 1.6 and up.
BahaiResearch.com
I think you might put a normal version to drawable folder and not only drawable-mdpi folder.
fedj
+1  A: 

As you might see If you read that, screen size support was introduced in Android 1.6. This might explain why you are getting this issue. This means that maybe the drawable-mdpi folder is not properly detected by the system 1.5. Try adding a "drawable" folder with nothing else behind it and put your image in it.

Sephy
I renamed drawable-mdpi to drawable and it's working everywhere fine now. Thanks.
BahaiResearch.com
you'd better create a new folder "drawable" instead of replacing the drawable-mdpi, just in case you'd miss some screen sizes.
Sephy