Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

NullPointerException when using database object  RSS feed

 
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
Saloon Keeper
Posts: 1527
210
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • 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.

 
A day job? In an office? My worst nightmare! Comfort me tiny ad!
Thoughts on deprecation in Java
https://coderanch.com/t/683016/java/Deprecation-Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!