Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Regular Contributor
Posts: 70
Registered: ‎04-14-2010
My Device: bold 9000
My Carrier: new

i can't print image plz help

[ Edited ]

public class getimage extends UiApplication {
    public static void main(String[] args) {
        getimage theApp    =    new getimage();       
        theApp.enterEventDispatcher();  
    }//main
    
    getimage()
    {
        try {
            pushScreen(new NewScreen() );
                         
        } catch (IOException e) {
            e.printStackTrace();
        }   }    }




final class NewScreen extends MainScreen 
{    
    Field imageField;
 
     class RemindTask extends TimerTask {
         public void run() {
               imageField = new WebBitmapField(url);
                     
         }//run
     }//Task
 
    
     public NewScreen() throws IOException 
    {
        super();  
        try
        {    
            add(imageField);
      
            Timer timer = new Timer();
            timer.schedule (new RemindTask(),0, 1000);
          
        }  catch(Exception e){}

       } }}

 

i just checked image on simulator it was perfect 

and now.i want to re-download and re-paint image  every 2 seconds

because server is webcam that sending jpg

but this source is not working


i only saw the white screen

 

what wrong with this source ?       

    

Developer
Posts: 58
Registered: ‎09-23-2009
My Device: Not Specified

Re: i can't print image plz help

Hi!

 

This WebBitmapField, is it from Coderholic - Blackberry WebBitmapField?

 

try this code: 

 

 

    class RemindTask extends TimerTask {
        public void run() {
        	  WebBitmapField newImageField = new WebBitmapField(url);
              replace(imageField, newImageField);
              imageField = newImageField;
        }//run
    }//Task

 

 

My opinion is you cannot afford 2 seconds even with fast wifi.  

What you can try to do is download not the full image but some kind of offset, difference between current image and previous.

Regular Contributor
Posts: 70
Registered: ‎04-14-2010
My Device: bold 9000
My Carrier: new

Re: i can't print image plz help

yes ,it is Coderholic - Blackberry WebBitmapField

 

unfortunately, it doesn't work

 

i can see only white screen;;  T T

Highlighted
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: I can't print image plz help

So have you checked that the code is downloading an image on the real device.

 

Please review this Thread, especially the Simulator section and Required Reading, to understand that as far a network test is concerned, code working on the SImulator will probably not work on the device.

http://supportforums.blackberry.com/t5/Java-Development/Connecting-your-BlackBerry-http-and-socket-c...

 

Also for this application, I think the only way you are going to get an image to your device in 2 seconds is via WiFi, so that is the connection method I would use (exclusively).  And in this case, I would not use a TimerTask.  Sorry for giving you incorrect advice on the other Thread, but I would start a download Thread, that continually downloads the image, then stalls for 2 seconds between downloads.