Java.lang.IllegalStateException: Already attached Java.lang.IllegalStateException: Already attached android android

Java.lang.IllegalStateException: Already attached


In your onCreate, you're calling super.onCreate() twice, and also setContentView() twice. I'm pretty sure that's not what you want to do.


Problem is you first initialize textView1, and perform the button click, at that point you are just resetting any previous settings by calling onCreate() again, and before perfomClick methods hits getData() method, inside here also tries to access the text from textView1 but you called onCreate after that and set the view from scratch. That is why you cannot get it work, delete the duplicate code


Please attach logcat message and if possible DB file.This could be the possible problem, You might be reassign the already assigned db object while inserting in the table.