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
New Contributor
Posts: 2
Registered: ‎04-21-2010
My Device: 8900
My Carrier: Oi

Rotating Image

Hi everyone,

 

I am trying to develop a little application to slideshow images in a blackberry.

I´ve got the images to display after a period of time, however I am not beeing able to make the previous one

disapear before I can show the next one. It´s my first time developing for blackberry (I am a novice ideed), and

any help would be appreciated.

 

The code:

 

 

final class HelloWorldScreen extends MainScreen
{

	HelloWorldScreen()
	
	{  
	
		try{
		
		timer = new Timer();
		timer.scheduleAtFixedRate(new TimerMainEvent(),2000,2000);
		
		}
		
		catch(Exception e)
		
		{
		//do nothing
		}
		

	}

	Timer timer;
	public static int COUNT =0; 
	private String[] images = {"moma.png","google_color.png","nike.png","novartis_color.png","pfizer_color.png","heineken.png"};
	
	
    
	private class TimerMainEvent extends TimerTask
	{
	public void run()
		{
		
			if(COUNT == 5){
				COUNT = 0;
			} 
		UiApplication.getUiApplication().invokeLater(new Runnable()
			{
			
			public void run()
				{
				synchronized(UiApplication.getEventLock())
					{
					Bitmap IMAGEM = Bitmap.getBitmapResource(images[COUNT]);
				    BitmapField ImgBmpField = new BitmapField(IMAGEM);
			          add(ImgBmpField);
					}
				}
			});
		COUNT++;
		}
	}

}

 Thanks in advance, Rodolpho.

 

 

 

New Contributor
Posts: 2
Registered: ‎04-21-2010
My Device: 8900
My Carrier: Oi

Slideshow Image

Anyone?

 

Tks!

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

Re: Slideshow Image

Welcome to the BlackBerry forums, sorry we haven't responded till now. 

 

If you retain a reference to the BitmapField you have previously added, then you have two options:

 

a) Delete it, then add the new one

b) Change the Bitmap associated with the BitmapField (using its set(...) method).