×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    5

    Canvas and paint()

    Hello,

    I wrote an Midlet for my N82 phone. My problem is that I can't call a config Method that setups some variables for painting with paint().

    Code:
    MyCanvas myCanvas = new MyCanvas();
    		readConfig();
    		calcPixelPosition(longitudCurrent, latitudeCurrent);
    		myCanvas.drawImages(xCurrent, yCurrent, config.getTileSize());
    		
    		d = Display.getDisplay(this);
    		d.setCurrent(myCanvas);
    The Methode
    myCanvas.drawImages(xCurrent, yCurrent, config.getTileSize());

    sets some variables but on my phone it is never called... in the emulator with eclipse it is called and the paint image draws the right image... but on my phone it doesn't.

    it seems that the myCanvas variable is never initailzed, because drawImages() is never called bevor paint() method is called.

    Can anyone help me??

    Thx

  2. #2
    Nokia Developer Expert
    Join Date
    May 2007
    Location
    Mexico D.F
    Posts
    351

    Re: Canvas and paint()

    Hello

    Does this drawImages method trigger a new Thread?
    If this is the same thread... there's no way it is not called... (really weird)

    Could you post some code of the constructor of the class MyCanvas and the method drawImages to see what is happening?

    What emulator are you using?

  3. #3
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Canvas and paint()

    It is really impossible to debug your code with this incomplete code snippet.
    It could be that readConfig() fails. It could be that calcPixelPosition() fails. It could be that new MyCanvas() fails. etc.

    Hartti

  4. #4
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: Canvas and paint()

    Hi,
    As Hartti has write that its really hard to find the problem in you this code segment.Either put the more information or try yourself.

    You better can do like this:--

    1.Put the SOP's and check. OR
    2.Debug your code On IDE. OR

    Always put the code in try block so that you can easily trace the exception and all.

    I must say there is a exception thrown in your code.Try to find in this way..
    Hope you can fix it...
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

Similar Threads

  1. How to paint Full screen using Canvas?
    By ongchiboon in forum Mobile Java General
    Replies: 8
    Last Post: 2011-07-09, 10:18
  2. kjava canvas paint problem on some nokia devices
    By danielwang99 in forum Mobile Java General
    Replies: 2
    Last Post: 2008-02-05, 17:07
  3. Is switching to another Canvas inside a paint() method OK?
    By falconpl in forum Mobile Java General
    Replies: 2
    Last Post: 2006-05-06, 00:15
  4. Canvas doesn't show when getWidth/getHeight is used
    By claudio4j in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2003-11-05, 08:41
  5. 7650 and 3650 Canvas and FullCanvas memory
    By marcilgen in forum Mobile Java General
    Replies: 5
    Last Post: 2003-07-08, 12:24

Posting Permissions

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