2

I have included demo project in my visual studio. But It is showing me error in the following statments. I have copied images and past into the mipmap as well. Please, can any one check what is the mistake and guide me as well. Thank you in advance.

  Bitmap fuelbar= BitmapFactory.decodeResource(getResources(), );//Bitmap image gets the fuel image from the resources folder
    Bitmap blastCraft = BitmapFactory.decodeResource(getResources(), R.drawable.explosion);//Bitmap image gets the explosion image from the resources folder
   Bitmap thruster = BitmapFactory.decodeResource(getResources(), R.drawable.thruster);//Bitmap image gets the small thruster image from the resources folder
        Bitmap main_flame = BitmapFactory.decodeResource(getResources(), R.drawable.main_flame);//Bitmap image gets the main flame image from the resources folder
5
  • can not resolve R.drawable.thruster
    – J. Vyas
    Oct 7, 2015 at 4:38
  • I think cause of the error is previously I had give project name com.abc and now I am giving com.xyz. Do you think so?
    – J. Vyas
    Oct 7, 2015 at 5:02
  • @ J. Vyas : Yes.. You have changed package name that is why R file is not generating..!!
    – AndiGeeky
    Oct 7, 2015 at 6:08
  • You can create a new project with package name com.xyz or just delete build folder and try to clean and rebuild project.. Plus remove old R imports from java files ..!!
    – AndiGeeky
    Oct 7, 2015 at 6:10
  • Thank you friend sending me reply. Please, could you guide me where can I find it in eclipse build folder
    – J. Vyas
    Oct 7, 2015 at 7:26

1 Answer 1

6

What folder you placed your bitmaps ? drawable or mipmap or both ?

If you placed in mipmap folder, you should change your code to:

Bitmap blastCraft = BitmapFactory.decodeResource(getResources(), R.mipmap.explosion);//Bitmap image gets the explosion image from the resources folder
Bitmap thruster = BitmapFactory.decodeResource(getResources(), R.mipmap.thruster);//Bitmap image gets the small thruster image from the resources folder
Bitmap main_flame = BitmapFactory.decodeResource(getResources(), R.mipmap.main_flame);//Bitmap image gets the main flame image from the resources folder
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.