Loading?

Started by
6 comments, last by Goguigo 17 years, 8 months ago
Is there any way to know when the cellphone, any, is loading? Thanks
Advertisement
What do you mean with "loading"?

Loading your application resources like images, MIDI files, sprites... ?
Or do you mean the time cellphone spend to make itself on?

Or is it another thing? [wink]

Regards,

John.
battery being charged, I think this is what he means.
br,Zolee------
no no, lol. :)

... like when you select Play and the cell is preparing to play the damn thing. ;)

Cya
Hi,

The loading screen shows to the user (with a progress bar or something like that), the time that the device is taking to load the images, load MIDI files, create tables, etc...

So, a way to make that is to call the paint method the times you want to update the progress bar. Something like this:

public static void loading(int perc, Graphics g) {	g.setColor(0,0,0);	g.fillRect(0,0,canvasWidth, canvasHeight);	g.setColor(255,255,255);	g.drawString("loading, " + perc + "%", canvasWidth/2, canvasHeight/2, Graphics.TOP | Graphics.HCenter);}public boolean loadRes() {	try {		//Load Character Image		Image imgC1 =  Image.createImage("&#47;res&#<span class="java-number">47</span>;c.png"</span>);<br>		loading(<span class="java-number">10</span>, <span class="java-keyword">this</span>.g);<br><br>		<span class="java-comment">//Create enemy object</span><br>		enemy = <span class="java-keyword">new</span> Enemy(ENEMY_1);<br>		loading(<span class="java-number">20</span>, <span class="java-keyword">this</span>.g);<br><br>		<span class="java-comment">//...</span><br><br>	}<br>	<span class="java-keyword">catch</span> (Exception e) {<br>		e.printStackTrace();<br>	}<br>}<br><br><br><br></pre></div><!--ENDSCRIPT--><br><br><br>Something like this.<br>It's a idea. Obviously not the better &#111;ne, but you can improve it. [wink]<br><br>Regards,<br><br>John.
Thanks man.

The sad news is that it didnt work perfectly.... i'm working with a MG150D LG cellphone, and it seems that it has a single buffer or something like that. The thing is that, i tried to create several loading methods and ways... but i get a whit screen allways on that cellphone. The problem is that the game takes 5 segs on loading, and the user may think "damn, maybe the game got stuck... just like windows" (lol).

:(

Thanks tho
Maybe is because your app aren't calling repaint() method.

You can try to call repaint() and serviceRepaints() to force the painting method to draw the loading screen.
Another way to do is running the loading method in another thread.

Regards,

John.
Thanks man, that fixed the problem. :D


Just curious... how can i load and run the program in 2 diferent threads?

thanks again

This topic is closed to new replies.

Advertisement