开发者

Subfolder in res folder not finding image

开发者 https://www.devze.com 2023-02-12 02:01 出处:网络
I\'m attempting to load a bitmap image from an images folder from within the res folder using - Bitmap.getBitmapResource(\"/images/bg_general.png\")

I'm attempting to load a bitmap image from an images folder from within the res folder using - Bitmap.getBitmapResource("/images/bg_general.png")

But the image is not being开发者_如何学Go found even though it exists at specified path. Im using blackberry eclipse plugin. Here is a snippet of my dir structure where the image is located -

Subfolder in res folder not finding image


Bitmap.getBitmapResource("bg_general.png") is the correct way to display the images. It works for me. Also, check whether the image is empty.


Try Bitmap.getBitmapResource("bg_general.png")

I think the file system is basically flattened in the cod file.


You might want to check "Bitmap.getBitmapResource - How to navigate through a folder hierarchy to refer to a PNG file."


Bitmap.getBitmapResource("images/bg_general.png");

remove the first /, the getBitmapResource function works with the res-folder as baseURL.


It looks like it Searches for the file name automatically.... logically/makes sence to me it would be:

Bitmap logo = Bitmap.getBitmapResource("src/001.png");

or

Bitmap logo = Bitmap.getBitmapResource("res/001.png");

but just saying "001.png" is enough

Bitmap logo = Bitmap.getBitmapResource("001.png");

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号