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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 191
Registered: ‎04-02-2013
My Device: BlackBerry Bold 9900
My Carrier: developer

Problem in displaying the loading screen.

Hi

 

I have created a new PopUp screen that contains the loading image...

Here is the code

public NewPopUp()
	{
		super(new VerticalFieldManager(NO_VERTICAL_SCROLL | USE_ALL_HEIGHT|USE_ALL_WIDTH));
	 		
		cc = new ComponentCanvas(displayWidth, displayHeight);
		add(cc);
	 		
		horizontalManager  = new HorizontalFieldManager(Manager.USE_ALL_HEIGHT| Manager.USE_ALL_WIDTH);
		cc.add(horizontalManager,displayWidth/2-gifEncodedImage.getWidth()/2,displayHeight/2-gifEncodedImage.getHeight()/2);
				
		AnimatedGIFField1 animatedGifField = new AnimatedGIFField1(gifEncodedImage, Field.FIELD_VCENTER);
		horizontalManager.add(animatedGifField);
	 	
		setBackground(BackgroundFactory.createSolidTransparentBackground(Color.WHITE, 0));
		setBorder(BorderFactory.createRoundedBorder(new XYEdges(), Border.STYLE_TRANSPARENT));
	   
	}

 

I want when i click on the image this screen gets displayed first and then the CustomThread runs.

So i am doing like this..

 

imageField = new BitmapField(image,BitmapField.FOCUSABLE)

{

protected boolean navigationClick(int status, int time)
{

UiApplication.getUiApplication.pushScreen(new NewPopUp());

 

CustomThread thread = new CustomThread();

thread.start();

}

};

 

 

But when i click on imageField first the thread gets called after the thread functionality completed, i get the loading screen. 

 

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

Re: Problem in displaying the loading screen.

Seems like you Thread is grabbing the EventThread or the EventLock.

 

Replace your CustomThread with a simple Thread that just issues a sleep for say 5 seconds, and see if the problem still occurs.  If it does, then can we see the simple Thread code. 

Developer
Posts: 191
Registered: ‎04-02-2013
My Device: BlackBerry Bold 9900
My Carrier: developer

Re: Problem in displaying the loading screen.

Hey

Thanks for the reply.

I have done the way you said.

 

Actually i have to run two threads , on the click of a button.

If i use only single thread then i am getting the loading screen but if i use two threads then loading screen does not displays.

 

And thread1 must join before thread2 gets start.

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

Re: Problem in displaying the loading screen.

Some debugging logic applies, just apply it to both Threads. 

 

Seems like one (or both) of your Threads is grabbing the EventThread or the EventLock.

 

Replace your Threads with two simple Threads that just issue a sleep for say 5 seconds, and see if the problem still occurs.  If it does, then can we see all code. 

Developer
Posts: 191
Registered: ‎04-02-2013
My Device: BlackBerry Bold 9900
My Carrier: developer

Re: Problem in displaying the loading screen.

I have replaced the customthread with the simple Thread.

1st thread is getting lat and long and in secon thread i am sending this latitude and longitude to the webservice to get the response.

 

 

So i am doing like this...

 

1)pushing the popup screen.

2)Thread 1 started

3)thread1 must join first

4)if i didn't get the lat and lon,displays the dialog box

5)else start the second thread.

 

Now i am not getting the PopUp screen when i click on the bitmapfield.

 

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

Re: Problem in displaying the loading screen.

In general, the approach you are taking should work.  The Popup should appear. 

 

However I am confident you have a coding bug that is resulting in your code holding the event thread or event lock.  I suspect it is related to the join.

 

The easiest way for us to resolve that is to see your code and then show you what is wrong in your code, but we do not want to wade through bucket loads of your code to help. 

 

So please do what I ask, replace BOTH your Threads with simple sleep, if the problem stil occurs, then show us your code.  You should be able to replicate this problem in less than 20 lines of code.  That is all we want to see. 

 

Clear now?