-1

I'm using Android studio , sqlite database my code was working correctly , but when I added "posid" column to "contacts" table the program doesn't work

logcat while insert contact enter image description here

......... thanks for everybody can help me

n-m
  • 39
  • 1
  • 1
  • 10

2 Answers2

1

You're referring to an EditText reference that has never been initialized. Namely, et4.

Also, I would suggest not having member variables that hold onto references to your views as this is a common source of memory leaks. Instead, just call findViewById when you need a local reference to your view.

Michael Krause
  • 4,225
  • 1
  • 18
  • 23
1

You didn't initialize the EditText et4 and that's the reason for the exception, also when you update the table schema "add column(s)" you should increase your database version, so that android can update the table

int DATABASE_VERSION = 2; // instead of 1
SaNtoRiaN
  • 2,057
  • 1
  • 13
  • 24