• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

null point exception

 
Anu sunny
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello sir,
Iam new to j2me so recently i wrote a program on image in that i got a" null point exception" and image did not display. my img in the src folder is that correct? Please help me.

Error is:
Project "img" loaded
Project settings saved
Building "img"
Build complete
Running with storage root DefaultColorPhone
startApp threw an Exception
java.lang.NullPointerException
java.lang.NullPointerException
at javax.microedition.lcdui.Form.append(+11)
at ImageTutorial.startApp(+45)
at javax.microedition.midlet.MIDletProxy.startApp(+7)
at com.sun.midp.midlet.Scheduler.schedule(+270)
at com.sun.midp.main.Main.runLocalClass(+28)
at com.sun.midp.main.Main.main(+116)
Execution completed.
735550 bytecodes executed
27 thread switches
741 classes in the system (including system classes)
3893 dynamic objects allocated (111700 bytes)
2 garbage collections (93492 bytes collected)

Code is:
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.


Do you see anything wrong on line 4 of the above code snippet?

Also please check your Purple Mooseages for an important administrative matter
 
Stuart A. Burkett
Ranch Hand
Posts: 679
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anu sss wrote:

Never do this. A catch block should not be empty. You should have at least a comment as to why you left it empty (there are occassionally good reasons for this). If you don't have a good reason, then you should at least print out the stack trace.
 
Anu sunny
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sir,
i wrote the code in catch block like "e.PrintTrace();" as you told before but, same exception error occured. so please help me
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Re-read Maneesh's post carefully, paying close attention to each line of code.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic