Why not Bitmap.GetBitmapResource)

I am trying to load a bitmap and I get an IllegalArgumentException in JDE 5.0.0 (have not compiled with previous can).  The file exists in the project, in fact, it is even used for the transfer of the icon of the Application - that work spendidly.  I created the image in Adobe Illustrator and exported as a 100 x 75 pixels format PNG-24. I realized another PNG this way that exists in the project who is responsible (for the unfolded above).  I tried to produce another image and load, with the two images previous (one that works and one that doesn't work) in the project and it fails with this defense, too.

No restrictions on the inclusion of images in projects?

Thank you

Brandon

The simple code:

final Bitmap bm1 = Bitmap.getBitmapResource("cameraRollover.png");

The call stack:

Thread [StarfaceRecoApp(230)id=321742848] (Suspended (exception IllegalArgumentException))
    Resource.getIconOffset(byte[], int) line: 158
    Resource.getIconBytes(byte[], int) line: 188
    StarfaceRecoAppRIMResources(Resource).findResource(String) line: 63
    StarfaceRecoAppRIMResources(Resource).getResource(String) line: 103
    Bitmap.getBitmapResource(String, String) line: 2333
    Bitmap.getBitmapResource(String) line: 2359
    MainHubScreen.(StarfaceApp$StarfaceRecoApp) line: 30
    StarfaceApp$StarfaceRecoApp.() line: 187
    StarfaceApp$StarfaceRecoApp.main(String[]) line: 27

Hello

I don't know, but have you tried to do something like that?

PNGEncodedImage.getEncodedImageResource("cameraRollover.png").getBitmap()

Since it is a PNG image.

Tags: BlackBerry Developers

Similar Questions

  • Bitmap.getBitmapResource (...) does not find my file?

    Hi all, I'm a 1st year student at the University of Warwick (United Kingdom) and I'm writing a small application for the Blackberry Storm, but I can't get my code to use just...

    Bitmap image = Bitmap.getBitmapResource ("c.gif");

    BitmapField bField = new BitmapField (image, BitmapField.FOCUSABLE);

    Add (bField);

    if(image == null) {Add (new RichTextField ("zero!")) ;}

    ^^ the snippet above is what I wrote, as far as I can see it is all very well, and the c.gif file is in the same directory as the source .java code when I Isaiah to compile the project (in the RIM JDE)

    When I run my app in the Simulator, rather than the displayed image, I just get "null!" printed...

    I don't know I'm just something dumb/obvious but I tried to move the .gif to different folders, but I can't make it work

    Thanks for reading this,

    Harri

    You have added the file to the project?

  • Bitmap.getBitmapResource bug?

    Hello

    I try to use Bitmap.getBitmapResource and it cannot read the file.

    I tested this code

    DataInputStream din = new DataInputStream(this.getClass().getResourceAsStream(fileName));
    byte[] buff1 = new byte[din.available()];
    din.readFully(buff1);
    Bitmap bitmap1 = Bitmap.createBitmapFromPNG(buff1, 0, buff1.length);
    System.out.println("Bitmap from buffer: "+bitmap1);
    
    Bitmap bitmap2 = Bitmap.getBitmapResource(fileName);
    System.out.println("Bitmap from resource: "+bitmap2);
    

    and the output is:

    Bitmap of the buffer: net.rim.device.api.system.Bitmap@37152698

    CAFETERIA: could not find /8000_100%bitmapfont.png

    Bitmap from resource: null

    is this a known problem or am I missing something?

    Thank you

    Guy

    To summarize, what you're saying, is that the same "filename" provides valid data when you read using

    Class.getResourceAsStream (),

    but fails when you use it in

    Bitmap.getBitmapResource (fileName);

    I think the problem is the main "/" is necessary for the first method, but not for the second.  Give a try to test this:

    Bitmap bitmap2 = Bitmap.getBitmapResource (fileName.substring (1));

  • Malfunction Bitmap.getBitmapResource

    I have an image in the res project folder and load the bitmap as the background of the screen with Bitmap.getBitmapResource ("pic.png").

    On a device, it works and finds the image in the res folder, but on another device, it will return null and can't seem to find the «pic.png» When I put the pic.png in the res and the src folder, it works on both devices.

    No idea why this is happening?

    It seems to be resolved when I place the files in a subfolder of the folder res for example folder named img and then access it with the img/pic.png path. The problem seems to be that in the root folder.

    Thanks anyway

  • Too much like Samsung: why not try it?

    Apple users don't want all our applications, notifications or 'ways to use the phone' or 'like samsung or android phones." Which will lead more people to their market. What happened to the innovative apple, which launched the iPhone? Nobody had seen a scrolling screen [when deflected] front. Nobody had seen apps or internet the iPhone in a way he did.

    Instead of looking to make things look more uniform like other telephone companies... Why not try to do something nobody has ever done before.

    Optical Lafarge, for example designed glasses that will put the glasses of google to shame. There is technology out there to make a phone clears the screen. You could still have the top and the bottom of the iPhone is the black bar where your battery would be in place etc. so that everyone can have the phone, they always wanted: phone The Tony Stark.

    It is quite easy for you to understand if he arrived at the place of the apple logo on the back of the phone or on the bottom or a chassis etc, but why not "two" batteries Wireless charging. a redesigned (as your macbook) to adapt the new clear phone (bottom) and the second to be located in the other "non-transparent" part as a solar powered battery to make it load when your phone is just sitting on its own... Obviously not as fast as being connected or wireless... but nevertheless he would become the first HYBRID phone that everyone has been waiting for.

    This is how I think that APPLE should do things. Being innovative doesn't mean "do what that other people do copy and then try to do better." That's what competition is supposed to do. When apple came out with new phones from iPhone to iPhone 4, they put the competition to shame. I remember a commercial Android who says more 'fast as the iPhone.' A week later, a new iPhone is released and put that commercial to shame so it never aired again.

    It's the Apple, we know and love. So if you want to be ahead of the market for any other mobile device, then you will make a clear phone out of the gorilla glass or hard extra stuff that is currently in your watches, so it is not breaking when you sneeze and you put wireless charge, a second solar battery, and siri will continue to improve as you work toward him making similar to an AI interactive as she understands us.

    So I guess the question really is: apple decides to take these technological leaps, or can I apply for a job at the company to throw these ideas around? (half joking about that second part.

    We are mainly end users

    Please send your comments to , if you wish, at Apple - Feedback

  • Why not FF 14 mobile plug-ins support youtube?

    Why not FF 14 mobile plug-ins support youtube?

    The mobile Firefox 14.0 does not support Flash if you use Android 2 or 4 (does not work on Android 3). Also if the device has a Tegra 2 processor, there is a known conflict prevent Flash to work.

    What is your model of phone/Tablet specifically that this would help to answer why Flash is not working.

  • Why not print anything from a web page?

    Why not print anything from a web page?

    Thanks Petstopman. I guess I'll have to go to IE when I want to print off the web. Looks like it would make FF take knowledge.
    Rowane

  • After the ff6 3.5 update, I don't have the orange button ff. Why not?

    Update 3.5 to 6. Supposed to have a button menu firefix.
    I haven't it. Why not??

    Maybe because you're showing the bar menu, which is supposed to be one or the other.

    View > toolbars > (uncheck) menu bar

    Or maybe you are in mode full screen that is pushed power with F11

    Please mark "resolved" a response that will better help others with a similar problem - hope it was her.

    You can make Firefox 6.0 look to Firefox 3.6. *, see numbered items 1-10 of the next topic difficulty Firefox 4.0 UI toolbar, problems (make Firefox 4.0 to 6.0, resemble 3.6). If you make changes, you must be aware of what has changed and what it takes to use changed or missing features.

    It is much more beyond these first 10 steps in the list, if you want to make Firefox more functional.

  • Why not zoom gesture in the work of Lion in the web pages of Firefox?

    I have the latest Firefox and now the last Lion OS X:. But the pinch to zoom gesture (that works in Safari) won't work in Firefox web pages. I thought that Firefox has been updated to work with Lion. So why not zoom or is there something I should do for FF to get this feature?

    This seems to be a firefox problem know and who work on and with possible workaround solutions, see also thread: "Back/Forward gestures don't work in Mac OS X Lion" - >/issues/853020

  • Why not in the list of countries, the Azerbaijan and the Georgia? I am a citizen of Georgia, but currently working and living in Azerbaijan. The absence of these countries created barriers to e-payment. As I said I have currently in the territory of the A

    Why not in the list of countries, the Azerbaijan and the Georgia? I am a citizen of Georgia, but currently working and living in Azerbaijan. The absence of these countries created barriers to e-payment. As I said, I currently have in the territory of the Azerbaijan can't use Visa and Master Card and also problem with cards issued in Azerbaijan! What is the reason, can you explain?

    Hello

    It is a community of support based on the user, though I'm afraid that nobody here can speak you either the reasons for decisions from Apple or whatever plans unannounced Apple (for example, if and when pay Apple will launch in a given country).

    If you are wanting to see pay Apple throw in Azerbaijan and Georgia, you can let Apple know here:

    https://www.Apple.com/feedback/Apple-pay.html

  • Why not go to the 10.6.3 on apple, appstore or updater mac OS.

    Why not go to the 10.6.3 on apple, appstore or updater mac OS.

    Not true, the 10.6.8 combo will update any previous version of 10.6 to 10.6.8.

  • Why not Skype allows you to choose a user name?

    Today, I tried to create a new Skype account to use in a professional environment, and I realized that therefore more to choose a Skype name, all new accounts are given a generated automatically.

    Why have all the user names if they are automatically generated all the? Why not just use email as username?

    You can always create a new account, Skype Name using this form:

    https://login.Skype.com/registration

  • Why I can't receive calls, and why not activate my iMessage? I can't send or receive texts

    Why can't I receive calls? And why not my iMessage never activate? I can't send or receive texts

    You seem to have more than one thing is done. Calls and texts (SMS) are a function of carrier. If you are unable to receive calls, you must contact your operator. You can make calls? Regarding activation of iMessage, I believe that it is related to your problem of text. IMessage activate, the phone sends a SMS hidden on Apple servers to the United Kingdom. If your carrier doesn't support iMessage, either you don't have a SMS plan for your phone, then it will not send, and your phone will not receive the answer. Check with your carrier to solve the problems of your cell phones.

  • Satellite A100-451: second partition appears as E - why not D?

    Hello

    I have a SAT. A100-451 running Vista. The hard drive is 160 GB and it is partitioned (factory settings) into 2 logical drives, i.e. Vista (C :) and Data(E:), chacun nominalement 80Go.)

    Why is the data on E: partition, why not D:?

    I have assumed that D: was reserved for the recovery partition, but if I insert a USB key, it configures the D: drive.

    I'm not worried by the present, just puzzled?

    Thank you

    KK

    Hello

    I have to smile during read this ;)

    The letter D: was reserved for the STRANGE-> CD/DVD drive. That's a common fact.

    But of course, the letters are editable and you can assign to what you want.
    You can do it in disk management.

    If you n t know how to do you can do a search on the net for more details

  • Why not "share" Garage Band as mp3 with iTunes 10.1.0 regardless of the import settings?

    Why not "share" Garage Band as mp3 with iTunes 10.1.0 regardless of the import settings? iTunes is configured to import into the mp3 format, yet each importation of Garage Band since update last week comes as AAFC and must then be converted to mp3.

    Use "share > song on the record" in GarageBand and button and select the "MP3". Then import the exported to iTunes MP3.

Maybe you are looking for

  • How can I stop other sites resizing FireFox (switch to full screen)?

    Can I configure FireFox to stay in my default size. A chat site, sure I'll change Firefox in full screen but also resize a much smaller second screen. I put FireFox not open a new window, but a new tab. website: uk.worldsbiggestchat.com Need help ple

  • Required for all drivers of Windows XP Home SP2 for Satellite U305-S2808 edition

    Hello I installed win XP SP2 in Satellite U305-S2808. How I can get all the drivers for it? I appreciate your help. Kind regards Saleh

  • problem after service

    Ive had my phone on the service, surprise, nothing is better except the cracking of the screen that is exchanged. And now I've got a ring when I run my finger 1-2mm above the glass, when I touch the glass it disappear. I managed to get the ring on th

  • Dell PC Restore from Symantec

    I let an employee use this laptop and it seems that this fool wiped out c:\ drive and installed XP Pro.  I need Windows Vista reinstalled.  Again, I have drive d: / with the original as sent image.  The only problem I have is that I don't have the De

  • How to add manually internal termination points on ISE 2.1

    Hello.. I just installed cisco ISE 2.1. I can't find a menu to add internal endpoint on ISE 2.1, I intend to add many MAC-Address to ISE. am I missing something? insofar as on ISE 1.1 there is a menu to add add internal endpoint... and is it possible