You Are Here:

Community: Developer Discussion Boards

#1 Old Repainting progress bar (while loading app) - 2005-04-13, 06:17

Join Date: Nov 2003
Posts: 14
wedge_
Offline
Registered User
I have an application which is big enough to take some time to load on older Nokia phones, load time is around 25 seconds, and instead of static loading screen I would like to have a progress bar displaying the load progress.

The situation is like this. There is a loading canvas screen, that is first shown. Then the loading of all other data starts. In the canvas class there is a timer thread that sleeps ~500ms and calls repaint and serviceRepaints [these get called properly]. However the screen is never repainted, and I suspect the problem is that main thread that is responsible for redraw events is loading classes and thus never repaints the screen..

How can it be implemented properly, I have seen ie. games that during initial load have a progress bar that shows the progress of the game loading...

Sorry for the long description, and thanks for any help.
Reply With Quote

#2 Old 2005-04-13, 08:38

Join Date: Nov 2003
Posts: 14
wedge_
Offline
Registered User
Never mind this, it was just my silly mistake. it's working now
Reply With Quote

#3 Old Re: Repainting progress bar (while loading app) - 2005-10-06, 12:52

Join Date: Sep 2005
Posts: 3
rbarata
Offline
Registered User
Hi Wedge_!
Could tou give me some ideas about creating and using that progress bar??

Thank you.
Reply With Quote

#4 Old Re: Repainting progress bar (while loading app) - 2005-10-06, 13:54

Join Date: Mar 2005
Posts: 499
Location: Paris
njzk2
Offline
Regular Contributor
basically, say you have a Canvas c, and a timer t, and a timertask tt:

tt:
private void run(){
c.repaint();
}

c:
private int count = 0;

protected void paint(Graphics g){
g.setColor(white);
g.drawRect(5, getHeight() / 2 - 10, getWidth() - 10, 20);
g.setColor(black);
g.drawRect(5, getHeight() / 2 - 10, (getWidth - 10) * count / 100, 20)

count++;
}

and in your midlet :

Display.getDisplay(this).setCurrent(c);
t.schedule(tt, 0, period);

it will show a progress bar that will move by 1% every 'period' milisecond
Reply With Quote

#5 Old Re: Repainting progress bar (while loading app) - 2005-10-07, 01:54

Join Date: Nov 2003
Posts: 14
wedge_
Offline
Registered User
Basically my problem was that I wasn't allowing time for the screen to be shown, and it just showed 100% when game was loaded and immediately jumped to next (main menu) screen.

So what I did is in canvas of load screen I have a tiny tiny wait state before I start loading classes, this forces the canvas visible before starting the loading of classes. And when you want to update loading bar, remember to call serviceRepaints() after repaint to force repaint of canvas, no need to timers or anything there as the thread that loads all classes is the one requesting of update for progress bar and waits serviceRepaints() to complete before continuing class loading... Hope this helps
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d18645X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZentertainmentQ qfnZtopicQUqfnTopicZj2meQ qfnZtopicQUqfnTopicZjavaQ qfnZtopicQUqfnTopicZmediaQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ