BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 05-09-2007, 02:25 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: berlin, germany
Model: 8310
PIN: N/A
Carrier: vodafone
Posts: 163
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with TimerTask and images

Please Login to Remove!

Hi,
I have a TimerTask, which should draw some images and change them all x sec...

Now I have a problem: The Graphic I create cannot be added to the screen. To understndy the problem better, here's my source:
Code:
final class TimerTask extends Thread  {
       LabelField label1 = new LabelField("Batteriestand: wird ermittelt...");
       LabelField label2 = new LabelField("GPRS Status wird ermittelt...");
       DateField datumFeld = new DateField("Letzte Aktualisierung: ",System.currentTimeMillis(),DateField.DATE_TIME | Field.READONLY);
       Bitmap myBitmap = Bitmap.getBitmapResource("batterie.png");
       Graphics balken = new Graphics(myBitmap);
       balken.drawBitmap(0,0,12,12,myBitmap,0,0);
       
       public TimerTask()
        {
        }
             
        public void run() {
            add(label1);
            add(balken);
            add(label2);
            add(datumFeld);
But my lovely compiler says:
[quote="Lovely Compiler"]<identifier> expected
balken.drawBitmap(0,0,12,12,myBitmap,0,0);
illegal start of type
balken.drawBitmap(0,0,12,12,myBitmap,0,0);[/code]

Then i treid this little one here:
Code:
/*...*/
Bitmap myBitmap = Bitmap.getBitmapResource("batterie.png");
       Graphics balken = new Graphics(myBitmap);
      // balken.drawBitmap(0,0,12,12,myBitmap,0,0);
       BitmapField myBatterie = new BitmapField(myBitmap);
/*...*/
And the compiler answered:
Quote:
cannot find symbol
symbol : method add(net.rim.device.api.ui.Graphics)
location: class HelloWorldScreen.TimerTask
add(balken);
häää? I really don't understand why... it works with the labels, so why not with thy Graphics?

I need your help again, please...

thanks hibbert
Offline  
Old 05-09-2007, 08:14 AM   #2 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Hibbert,
Just looking at what you have here, it seems you're trying to leverage the add method of net.rim.device.api.ui.Screen, which accepts only a Field or it's descendants. Instead of trying to add a Graphics object, maybe try adding a BitmapField constructed with myBitmap.
Offline  
Old 05-10-2007, 02:33 AM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: berlin, germany
Model: 8310
PIN: N/A
Carrier: vodafone
Posts: 163
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
i had a look into the docu an found something that helps me.
now i works, just create a bitmap, a bitmapField and a graphics, draw on the Graphics and add bitmapfield.

hibbert
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright © 2004-2014 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.