• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NullPointerException when using database object

 
Julius Almeuda
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm new to Android, and i've got some issues. It looks like it's saying that's having an null object passed to it, but I'm not sure. Where I missed a step? Any help is appreciated.

Thanks in advance.

Logcat:


EmployeeOperations:



MainActivity:


 
Ron McLeod
Bartender
Pie
Posts: 1022
64
Android Eclipse IDE Java Linux MySQL Database Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In line 138 you create a new instance of EmployeeOperations, but never call its open() method (which presumably calls DatabaseHelper#getWritableDatabase()), so the instance's reference to the database does not get initialized, and is null when it is used in the next line.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic