R.drawable cannot resolve image

I have checked a lot of questions on stackoverflow and I seem to have all the correct things but my R.drawable wont detect my image. It is in /res/drawable and in all the other folders (mdpi, hdpi etc.)

    ShipImage = context.getResources().getDrawable(R.drawable.player);

And here is my R.java

        public static final class drawable {
        public static final int background=0x7f020000;
        public static final int buttons=0x7f020001;
        public static final int dead=0x7f020002;
        public static final int enemy=0x7f020003;
        public static final int ic_launcher=0x7f020004;
        public static final int play_btn=0x7f020005;
        public static final int player=0x7f020006;


Are you sure You import import com.yourcompanyname.product.R ?

instead of

import android.R;

import com.yourcompanyname.product.R differs from import android.R

First is your project R file, that is generated by SDK.

import android.R is built-in R file, that is provided by Android.

Make sure your image is png. Also check that you have saved the layout where you have to inflate the image.

Need Your Help

Recent files in folder

linux unix file find logging

I want to check files which are recently added to the folder in unix environment.

What is the difference between async.waterfall and async.series

javascript node.js asynchronous node-async

The nodejs async module: https://github.com/caolan/async provides 2 similar methods, async.waterfall and async.series.