×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Sep 2009
    Location
    Bangalore, India
    Posts
    49

    Question Savign and retrieving Image in RMS

    Can anyone please provide me some link or code for saving and retrieving an image in RMS ??
    Regards
    Nilanchala

  2. #2
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: Savign and retrieving Image in RMS

    Quote Originally Posted by nilanchalapanigrahy View Post
    Can anyone please provide me some link or code for saving and retrieving an image in RMS ??
    Saving Images in RMS, if it is for providing picture gallery to your application - you fetch image data in btyes[] from server over http connection and add these bytes to Recordstore as is, adding One image per record.
    Retrieving Image from RMS:
    Just fetch the record from RMS you will get a bytes of image, use CreateImage(bytes,0,bytes.length()) to create Image.

    If you have captured Images from Camera usinh VideoControl.getSnapShot(null) - you get Bytes which you can store & retrieve from RMS as above.

    If you have your own image, then you can getRGB int[] which you can save as is in RMS and retrieve as is from RMS and then create Image using CreateRGBImage method.

    Or you get the bytes from Image using NokiaUI getPixels methods - save & retrieve in RMS and do CreateImage() simple.

    To Store: Image byte data
    this return - record id from RMS for the stored Image
    Code:
    public synchronized int addImageRecord(byte[] bytes) {
            try {
                return recordStore.addRecord(bytes,0,bytes.length);
            } catch (RecordStoreException e) {
                e.printStackTrace();
            }
            return -1;
        }
    To retrieve \:
    Code:
    /**
         * Retrieves the PNG image  from the RMS using the given id
         *@param id  the ID of the record to use in this operation
         */    
        public synchronized Image getPng(int id) {
            Image image=null;
            try {
                byte[] imga = recordStore.getRecord(id);
                image=Image.createImage(imga,0,imga.length);
                
            } catch (RecordStoreException e) {
                image=null;
            }
            return image;
        }
    Last edited by ektasrv; 2010-06-22 at 10:30.
    Thanks,
    Ekta

  3. #3
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: Savign and retrieving Image in RMS

    Quote Originally Posted by nilanchalapanigrahy View Post
    Can anyone please provide me some link or code for saving and retrieving an image in RMS ??
    Hi, Nilanchala
    Try to search before ask,
    Cache images in RMS in J2ME

    Best regards,
    RaHuL

Similar Threads

  1. Problem with saving and retrieving text with the RMS
    By Radst3r in forum Mobile Java General
    Replies: 2
    Last Post: 2010-04-28, 11:23
  2. Retrieving an image from a web service ?
    By Infernal01 in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2010-03-08, 11:26
  3. Midlet Problem in Retrieving an Image from the Internet
    By gaurav.gupta in forum Mobile Java General
    Replies: 11
    Last Post: 2009-06-13, 03:46
  4. Reading and Writing an Image from the RMS
    By nilesh_27 in forum Mobile Java General
    Replies: 3
    Last Post: 2005-04-02, 13:01
  5. retrieving image
    By anbuuu in forum Symbian C++
    Replies: 0
    Last Post: 2004-08-09, 07:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •