Discussion Board

Results 1 to 12 of 12

Hybrid View

  1. #1
    Registered User
    Join Date
    Aug 2013
    Posts
    37

    [moved] code to take screenshot in j2me

    I want a working j2me code for taking screenshot of the canvas.. I have already searched the forum and got many codes.. I have tried all of them but none works.. So please give me a working code along with the paint method..

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    686

    Re: [help] code to take screenshot in j2me

    there is no code to take the actual screenshot of the device.
    You can however (if your using canvas or gamecanvas) save an image of your own app screen.
    create an image with the dimmensions of your canvas using Image.createImage(width,height)
    save its Graphics object using Image.getGraphics();
    call your canvas Paint method with the image Graphics object.
    now you have a copy image of the canvas screen, now all you need is to save it as an image to the file system.
    You can save it as bitmap (which is the easiest since your saving each pixel data and there is no compression of any kind so just traversing over the Image RGB array)
    or you can save it as a PNG or JPG which means you will need to "encode" the image RGB data (which you obtain using Image.getRGB(...)) you can right your own or google for such (here is a png encoder that is good for j2me http://www.chrfr.de/software/midp_png.html i've tested it and it works)

  3. #3
    Registered User
    Join Date
    Aug 2013
    Posts
    37

    Re: [help] code to take screenshot in j2me

    I have already tested that and it also saves the image in png format to my memory card but the problem is that the image cannot be opened.

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,185

    Re: [help] code to take screenshot in j2me

    I suppose you are then saving it wrongly. So do check what was said on saving the image., Also you need to set the extension right, since who ever opens the image, likely will not use any data recognistion for opening it, and simply relies on the extension to match the actual data inside the image file.

  5. #5
    Registered User
    Join Date
    Aug 2013
    Posts
    37

    Re: [help] code to take screenshot in j2me

    About your previous message after converting the image into int[] if I save the image with .png extention will i work. And the png.java file's link you gave has a command toPNG() which my compiler cant recognize.
    Last edited by subha095; 2013-08-26 at 01:29.

  6. #6
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    686

    Re: [help] code to take screenshot in j2me

    Sorry but i couldnt understand your message, can you please try and explain again what isnt working for you with the link i gave you and perhaps also attached your source code of your implementation of this.

  7. #7
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    686

    Re: [help] code to take screenshot in j2me

    subha095: i can guarantee that it does work because i have used it in the past, infact you can check out my app Snowman Builder http://store.ovi.com/content/357751 that saves the image you create on the screen to the phone file system and it uses the same (with some extra stuff i've put it to make the PNG compressed)
    If you liked the app dont forget to give it a nice 5 star rating and if you need extra help i'm here.

Similar Threads

  1. [moved] register my location (coordinate ) using J2ME code
    By souhir in forum Mobile Java General
    Replies: 12
    Last Post: 2013-02-13, 18:12
  2. TAKING SCREENSHOT IN SYMBIAN S60 USING J2ME
    By ajay.hakke in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2012-04-10, 15:31
  3. Can I call Symbian C++ code from J2me code?
    By Rupa in forum Mobile Java General
    Replies: 6
    Last Post: 2010-11-24, 14:31
  4. Replies: 2
    Last Post: 2010-06-23, 11:33
  5. J2ME Screenshot of a Canvas
    By mtgbe in forum Mobile Java General
    Replies: 9
    Last Post: 2010-01-19, 17:05

Posting Permissions

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