hi all,
i am devlope an application related to the downloading image and show this downloaded image on the canvas.
The image downloaded successfully but it cant display on canvas .
pls help me ASAP....
Thanx....
hi all,
i am devlope an application related to the downloading image and show this downloaded image on the canvas.
The image downloaded successfully but it cant display on canvas .
pls help me ASAP....
Thanx....
Hi devdattac,
which problem are you encountering with your code? Using the image bytes to create your Image instance and then using Graphics drawImage() method should work.. do you get any Exceptions with it?
Pit
thanx 4 reply,
i got error on line ........
display.setCurrent(canvas);
where canvas is object of class Canvas
Which kind of Exception are you getting? Also, do you properly initialize your display and canvas variables?
Pit
I face this kind of problem when i was learning. You please check that are you allocation memory with new or not. I done that thing wrong so check it.
If you're getting a NullPointerException on that code line, that it's likely you have not properly initialized your display variable, as told also by honest_success.
Something like this should be in your code:
PitCode:display = Display.getDisplay(yourMidletInstance);
that or u are trying to show the canvas object (instanced of Canvas) without having it instantiated to begin with...
also using the name canvas is very unappropriate, simply because it looks too much as the predefinied class Canvas, call it myCanvas or whatever istead and at some point u will use :
myCanvas canvasToUse = new myCanvas();
display.setCurrent(canvasToUse);
for the myCanvas class ucan start with extending the Canvas class itself :
class myCanvas extends Canvas
or
class myCanvas extends GameCanvas
Dear Tiger you can show images in a canvas, you will need to create a class
/* Frist you need to create your canvas */
public class yourCanvas extends Canvas { ...
/* all the magic is in the paint method */
public void paint(Graphics g){ ...
/* also you need instansiate yourCanvas */
yourCanvas = new biGraphCanvas(...);
/* And finally you need to show as a diplayable */
display.setCurrent(yourCanvas);
When I started i used a sample program Hello midlet is just great
You can show images in an alert too
I hope it helps you
Sergio
Sergio Mabres
Prominente S.A.
Argentina
hehe thx for the input,
but I didnt have any problems at all...
The TS has, so I was only trying to help him out...
guess u misunderstood...