BlackBerry Forums Support Community

Closed Thread
LinkBack Thread Tools
Old 10-30-2007, 07:19 AM   #1 (permalink)
Thumbs Must Hurt
Join Date: Jun 2007
Model: 8800
Carrier: GPRS
Posts: 68
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question draw text on a picture

Please Login to Remove!


I'm trying to draw something on a picture showed on BB, and I'm confused how to do it. Firstly, I read a picture from card and show it on BB; and now I want to draw text on the picture by a menu "write", could anyone help me ?
Thank you very much!
import net.rim.device.api.ui.*;
import java.lang.*;
import java.util.*;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.system.*;
import net.rim.device.api.math.*;

class picViewer extends UiApplication
    public static void main(String[] args)
        //create a new instance of the application
        //and start the application on the event thread
        picViewer theApp = new picViewer();
    public picViewer() 
        pushScreen(new ViewScreenDemo());
    class ViewScreenDemo extends MainScreen
        private WriteMenuItem _writeMenuItem;
        private EncodedImage image;
        private class WriteMenuItem extends MenuItem 
            private WriteMenuItem() 
                super("write",100000, 5);
            public void run() 
        public ViewScreenDemo() 
            _writeMenuItem = new WriteMenuItem();
                FileConnection fconn = (FileConnection)"file:///SDCard/BlackBerry/pictures/1.jpg");
                // If no exception is thrown, then the URI is valid, but the file may or may not exist.
                if (fconn.exists()) {
                    InputStream input = fconn.openInputStream();
                    int available = (int)fconn.fileSize();
                    byte[] data = new byte[available];
          , 0, available);
                    EncodedImage image = EncodedImage.createEncodedImage(data,0,data.length);   
                    Bitmap b = image.getBitmap();
                    BitmapField picture = new BitmapField(b);  
                else {
                    add(new LabelField("Picture does not exist"));
            catch(Exception ioe)
            { System.out.println("error!");}
        protected void makeMenu(Menu menu, int instance) 
            super.makeMenu(menu, instance);
        public void onWrite()
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Sew Eurodrive Control Unit DBG11B-08 Keypad Panel Frequency Converter New
Sew Eurodrive Control Unit DBG11B-08 Keypad Panel Frequency Converter New pictureMontalvo MC3200-ce load cell amplifier module
Montalvo MC3200-ce load cell amplifier module pictureAMK interface E1210
AMK interface E1210 pictureKnick DC isolation amplifier 6310 A2
Knick DC isolation amplifier 6310 A2 pictureHoneywell C7076 sensor amplifier 220v
Honeywell C7076 sensor amplifier 220v picture

Copyright 2004-2016
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.