×

Discussion Board

Results 1 to 4 of 4

Thread: Image

Hybrid View

  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    13

    Image

    How can I get Image object from url, like Picture pic = getPicture(url) ?
    I tried to do this:
    PHP Code:
    Picture pic getPicture(url);
    Image im pic.getImage(); 
    but the image is still not loaded into pic.

  2. #2
    Regular Contributor
    Join Date
    Jul 2004
    Posts
    52

    Re: Image

    PHP Code? Shouldn't it be Helium/Widget/Script code?)

    Anyways problem with your code is that by the time you call pic.getImage() the image has not been loaded yet, and only placeholder image (loading bar) is returned.

    I remember that I added ITEM_CHANGED/ITEM_CANCEL event support for getPicture(). I am not sure if it has been released yet (cannot access source code right now), but if it is released it can be used like this

    Code:
    Picture pic = getPicture(url); 
    
    void actionPerformed(Shell shell, Component source, int action)
    {
      if (action == ITEM_CHANGED && source == pic) {
        Image img = pic.getImage();
      }
    }
    If it hasn't been released, need to hack a bit:

    Code:
    Picture pic = getPicture(url); 
    Image placeHolder = pic.getImage();
    
    schedule(1000);
    
    void timerEvent(Timer timer)
    {
      Image img = pic.getImage();
      if (image != placeHolder) {
        //img is the loaded image, or error placeholder ;(
      } else {
        //not loaded yet, lets wait one more second
        schedule(1000);
      }
    }
    Hope this helps,
    /render

  3. #3
    Registered User
    Join Date
    Dec 2008
    Posts
    13

    Re: Image

    Thanks, render. It help. I chose PHP because it has a syntax highlight in forum ).

  4. #4
    Registered User
    Join Date
    Dec 2008
    Posts
    13

    Re: Image

    _______________________________________________
    Last edited by jamapag; 2009-02-10 at 09:22. Reason: stupid question

Similar Threads

  1. --- ???save image problem??? ---
    By ferenn in forum Mobile Java Media (Graphics & Sounds)
    Replies: 6
    Last Post: 2007-10-01, 14:33
  2. Opening a JPEG Image
    By ummarbhutta in forum Mobile Java Media (Graphics & Sounds)
    Replies: 8
    Last Post: 2007-02-15, 06:34
  3. how to cut some part of Image
    By mshouab in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2006-08-04, 09:05
  4. HELP: Mutable Image to Immutable Image?
    By rj_cybersilver in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2005-03-26, 09:58
  5. Nokia Image Converter
    By davidpurdie in forum General Development Questions
    Replies: 0
    Last Post: 2004-02-18, 15:31

Posting Permissions

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