Skip to main content

Posts

Showing posts with the label blackberry

Screen capture and save to SDCard in Blackberry Java (OS4.3 and above)

Blackberry OS (4.3 and above) provides a very easy way to capture screen of device. We can use screenshot(Bitmap bmp) method of Display class. In this post you will see how to capture screen contents and save to a file on SDCard. First we will get width and height of screen. This is very important because Bitmap we pass to screenshot method must have same width and height as of screen. int screenWidth=Display.getWidth(); int screenHeight=Display.getHeight(); Next, create a Bitmap object of dimensions equivalent to width and height of screen. Bitmap bmpScreen=new Bitmap(screenWidth,screenHeight); Take screenshot using screenshot method of Display class Dispaly.screenshot(bmpScreen); Now bmpScreen contains our screen image data. Our next task is to save this data in a file on SDCard. Let's create PNGEncodedImage from this Bitmap. PNGEncodedImage imgToSave=PNGEncodedImage.encode(bmpScreen); Open a file to write this image FileConnection fc=(FileConnection)Connector...

Cannot find RIMIDEWin32Util.dll in Eclipse for Blackberry development

I switched to Windows 7 64 bit few months back and I upgraded all my tools/SDKs to 64 bit versions including JDK. Suddenly after I updated JDK to 64bit my Eclipse plugin that I use to develop Blackberry applications started giving this error on every start Cannot find RIMIDEWin32Util.dll. This is a required component of the IDE.  Solution to this problem is that install both JDK and Eclipse 32bit versions. And set the following environment variables in Windows JAVAHOME=path to the folder where JDK(32bit) is installed PATH=add path to bin folder of your JDK(32bit)

Blackberry round corner TextField with place holder text

While working on a blackberry project I was required to display a round corner text field with a place holder text. The logic was to display place holder text when TextField is not in focus and no text is entered by user (or text is cleared by user). As soon as TextField receives focus, placeholder text should be removed. Displaying place holder text when TextField is empty is very easy . You can just override TextField's  paint method and check if text is empty you can set text to place holder text. Here is a simple example protected void paint(Graphics g){     if (getText().compareTo("")==0){         setText( "Place holder text.." );     }     super.paint(g); } But displaying and removing of placeholder text on focus and unfocus was a bit of task so I came up with my own class and want to share with other fellow coders. import net.rim.device.api.ui.Color; import net.rim.device.api.ui.Graphics; import net.rim.device...