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: 74
Registered: ‎01-12-2012
My Device: Developer
My Carrier: Developer

Using CustomManager needs a screen update ? (synchronous)

One I am a newbie.. so forgive my ignorance :

I made my own custom manager (TopBarManager).
When I use it, the initial positions of the item in it are at wrong POSITION ...and if I don't call any Item in it from a Synchronous block , the ITEMs will remain at the wrong position.
However If I called any ITEM, the positions will be updated to the value I gave them in the first place (the right position)

So my problem is that it takes about a 0.5second for the ITEMs to take their right position and that is not good.
The following is my code, hope you can help me...
Thank you ...

 


------Code-------------- 

public class TopBarManager extends Manager {

...

public TopBarManager() {
super(Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR);
...
}
protected void sublayout(int width, int height) {

 Field field1 =  getField(0);

int x = 5;
int y = 5;

setPositionChild(field1,x,y); 
layoutChild(field1, width, height); 

...

   setExtent( Display.getWidth(), height1);

}

public int getPreferredWidth() {
return Display.getWidth();
}
public int getPreferredHeight() {
return Functions.mHeight;
}

}

-----------------

...

public myscreen(){

topbarManager = new TopBarManager();

labelfield item1 = new labelfield("5");

topbarManager.add(item1); 

//now when i run the application "item1" would appear in the wrong position

//however if I update "Item1" value from a synchronous block
// "item1" will be repositioned to the right coordinates.

..

.

add(topbarManager);

 

//my synchronous block

tt=new TimerTask() {
public void run() {

}

synchronized(UiApplication.getEventLock()) {

 // updating item one.

 // cancelling timer

// i also tried updating from a thread, i got the same result ...

 

}

}

};

t.scheduleAtFixedRate(Functions.tt, 0, 100);

 

 


}

-----------------------------------------------

 

BlackBerry Development Advisor
Posts: 15,784
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Using CustomManager needs a screen update ? (synchronous)

What do you mean by "update" an item? What are you doing there?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Regular Contributor
Posts: 74
Registered: ‎01-12-2012
My Device: Developer
My Carrier: Developer

Re: Using CustomManager needs a screen update ? (synchronous)

Item = any Object ; a bitmap a labelfield a manager...

I have a CustomManager that contains Objects and I update these Objects as time passes (after a specific interval)
However as soon the my Screen loads (the screen that contain this CustomManager) it puts the CustomManager's Objects in the wrong Coordinates for I think about 0.5 second...after that the Objects go back to there correct position.

Thank you for taking interest !
BlackBerry Development Advisor
Posts: 15,784
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Using CustomManager needs a screen update ? (synchronous)

But what is updated, just their content or are you changing anything else within the field?

 

Can you post a working sample that shows the delay?  

 

What BlackBerry Smartphone model and BlackBerry handheld software version are you testing on?  You can find this under Options, About on the BlackBerry Smartphone.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker