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
Developer
mishelka
Posts: 28
Registered: ‎09-01-2009
My Device: Not Specified

Problems with animated gif displaying

[ Edited ]

Hello again,

I have made some animated gif according to this link and I wanted to put this gif on the screen during data refreshing, as "working" state.

Problem is, that when I put it in front of other fields in the TableManager, it is no more transparent. Here's my shortened code:

 

public class TableManager extends VerticalFieldManager {

/** Vertical manager for all rows */
VerticalFieldManager manager;
/**Manager for the "working" gif image. */
VerticalFieldManager gifManager;
/** True if the table should display a "working" icon, false otherwise. */
private boolean WORKING = true;

public TableManager(boolean arrivals) {
super();
...
manager = new VerticalFieldManager(Manager.VERTICAL_SCROLL);
gifManager = new VerticalFieldManager();
gifManager.add(new AnimatedGifField((GIFEncodedImage) GIFEncodedImage.getEncodedImageResource(Globals.WORKING_GIF_PATH)));
}

... creating table and adding data ...

public void refresh(Vector data) {
if (WORKING) {
//the data are displayed and the animated gif icon is on the top
this.add(gifManager);
invalidate();
} else {
//display table with data
}
}

public void displayWorkingGif() {
WORKING = true;
refresh(new Vector());
}

public void undisplayWorkingGif() {
WORKING = false;
synchronized (UiApplication.getEventLock()) {
delete(gifManager);
}
}

protected void sublayout(int maxWidth, int maxHeight) {
super.sublayout(Display.getWidth(), Globals.HEADER_HEIGHT + Globals.ROW_COUNT * Globals.ROW_HEIGHT + Globals.ROW_COUNT - 1);
...
if (WORKING) {
//put the icon in the center of this manager.
setPositionChild(gifManager, (getPreferredWidth() - gifManager.getPreferredWidth()) / 2, (getPreferredHeight() - gifManager.getPreferredHeight()) / 2);

layoutChild(gifManager, gifManager.getPreferredWidth(), gifManager.getPreferredHeight());

}
}
}

 

 

I tried without using VerticalFieldManager for the gif image, but it doesn't work either...
Message Edited by mishelka on 09-03-2009 12:43 AM
Developer
mishelka
Posts: 28
Registered: ‎09-01-2009
My Device: Not Specified

Re: Problems with animated gif displaying

Okay, I tried replacing the gif with a LabelField, saying "Downloading, please wait..." and I made a Thread for it, that makes the three dots change like . -> .. -> ... -> .

I have the same problem like with the animated gif, sometimes the label displays with transparent background, sometimes with white. Has anyone a solution?