J2ME, continusly load image, low speed....

B

Boki

Hi All,
It seems that speed will become slower and slower after a while.

Could you please advice?
The image A / B are both 5KB size jpg file.

Best regards,
Boki.

====================
public void run()
{

int hhhhh=0;
lastSendTime=System.currentTimeMillis() ;
//////////////////////////////
while(got_ate0<100)
{


if (System.currentTimeMillis() - lastSendTime > 120)
{
lastSendTime=System.currentTimeMillis() ;


hhhhh=1-hhhhh;

try {
if (hhhhh==0)
GUI.aaimage = Image.createImage("/2.jpg");
else
GUI.aaimage = Image.createImage("/1.jpg");

}
catch (Exception e)
{
}
got_ate0++;
gui.repaint();

}
}
 
A

Andrew Thompson

Boki said:
Could you please advice?

My advice is 'post compilable code'.
The image A / B are both 5KB size jpg file.

Have you ruled out 'image caching'?
Check the freeMemory/totalMemory* each iteration.

* Yes, yes. Listed in the JavaDocs.
 
B

Boki

I don't know how to check

" freeMemory/totalMemory* each iteration"

..... I am using Sony Ericsson WTK toolbar / Netbeans 4.1/5.0

Why I do this is to simulate when I got a lot of jpg file ( from
Bluetooth ), can I decode/render in screen on time....


Best regards,
Boki.
 
B

Boki

Thanks, I think the root cause is - create , create , create.... , right?

I don't know which command can replace the data directly without create a
new memory space?
 
D

Darryl L. Pierce

Boki said:
Thanks, I think the root cause is - create , create , create.... , right?

I don't know which command can replace the data directly without create a
new memory space?

Images are immutable, so you have to create a new instance for each new
Image used.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top