×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Feb 2012
    Posts
    3

    Lightbulb Problem with canvas and Image Create, j2me

    Hello everybody, I'm begginer in this forum and I'm programming an aplication.
    I have problems with images, I'm trying to show an image "PNG", 90.4Kb, with a resolution 1600x1000.

    private Image imagen=null;

    public Image getImagen(){
    if(imagen==null){
    try {
    mapa = Image.createImage("imagen.png");

    } catch (IOException ex) {
    System.out.println("Error");
    }}

    return imagen;
    }

    protected void paint(Graphics g) {
    g.drawImage(getImagen(), 0, 0, 0);
    }

    it works in nokia 5530, but doesn't work in nokia x2-00, and when I change the image's size to a resolution of 400x250, it works in both. What is happenning?, what can I do?

  2. #2
    Regular Contributor
    Join Date
    Dec 2011
    Posts
    174

    Re: Problem with canvas and Image Create, j2me

    Hi nixinumbra and welcome to the Nokia Developer Discussion Boards!

    The reason why it's not working is that you are running out of memory on x2-00. The heap size on x2-00 is 2mb and on 5530 it is unlimited. Your 1600x1000 resolution image takes at least 1600*1000*2 = 3,2mb of memory depending on the color depth of the device. You can catch the error with OutOfMemoryError exception.

    -tiviinik
    Last edited by tiviinik; 2012-03-30 at 20:20.

  3. #3
    Registered User
    Join Date
    Feb 2012
    Posts
    3

    Re: Problem with canvas and Image Create, j2me

    Lots of thanks. Do you know how can I know the celphones' heap size, or how can i know how much memory uses my application?
    Last edited by nixinumbra; 2012-03-30 at 19:53.

  4. #4
    Regular Contributor
    Join Date
    Dec 2011
    Posts
    174

    Re: Problem with canvas and Image Create, j2me

    You can find the maximum Java heap size for a device from the below link. Choose a phone and open the Memory Functions tab.
    http://www.developer.nokia.com/Devic...pecifications/

    And here's couple of wiki articles on how to get the free an total memory in Java ME.
    http://www.developer.nokia.com/Commu...ory_in_Java_ME
    http://www.developer.nokia.com/Commu...ory_in_Java_ME

    -tiviinik

  5. #5
    Registered User
    Join Date
    Feb 2012
    Posts
    3

    Re: Problem with canvas and Image Create, j2me

    Wooa, It'll be perfect, thank you very much!
    Mmm, I have another problem: The aplication doesn't work on nokia e63, what is happening here?
    Last edited by nixinumbra; 2012-04-09 at 20:20.

Similar Threads

  1. Image hover effect on canvas in j2me
    By Meena ganesan in forum Mobile Java General
    Replies: 4
    Last Post: 2011-04-12, 08:44
  2. Create TextField using canvas in j2me application
    By rajan701v in forum Mobile Java General
    Replies: 1
    Last Post: 2011-01-20, 15:16
  3. How to create image using Canvas without using imageitem and graphics.drawimage?
    By kalki in forum Mobile Java Media (Graphics & Sounds)
    Replies: 5
    Last Post: 2010-06-23, 13:47
  4. Image as a menu bar in Canvas in j2me
    By soumengoswami in forum Mobile Java General
    Replies: 2
    Last Post: 2009-05-15, 07:25
  5. problem in display an image button on canvas(Background image)
    By mramin05 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2008-11-12, 04:51

Posting Permissions

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