Basic troubles with SQLite databases. Notepad tutorial of android?

It would be helpful if you copied the stack trace (using logcat / DDMS) or copied your entire SQLiteDBAdapter, but just looking at what you posted, you definitely have a problem in that you're using the wrong field name in the sqlite database create statement The "title" field should be renamed "name" to match your changed column name Change: private static final String DATABASE_CREATE = "create table notes (_id integer primary key autoincrement, " + "title text not null, body text not null) To private static final String DATABASE_CREATE = "create table notes (_id integer primary key autoincrement, " + "name text not null, body text not null) I also tend to just use the statics themselves in the create statement, so it could be written like the following: private static final String DATABASE_CREATE = "create table notes (" + KEY_ROWID + " integer primary key autoincrement, " + KEY_NAME + " text not null, " + KEY_BODY + " text not null) Then you could change the names often and not encounter database create breakage.

It would be helpful if you copied the stack trace (using logcat / DDMS) or copied your entire SQLiteDBAdapter, but just looking at what you posted, you definitely have a problem in that you're using the wrong field name in the sqlite database create statement. The "title" field should be renamed "name" to match your changed column name. Change: private static final String DATABASE_CREATE = "create table notes (_id integer primary key autoincrement, " + "title text not null, body text not null);"; To private static final String DATABASE_CREATE = "create table notes (_id integer primary key autoincrement, " + "name text not null, body text not null);"; I also tend to just use the statics themselves in the create statement, so it could be written like the following: private static final String DATABASE_CREATE = "create table notes (" + KEY_ROWID + " integer primary key autoincrement, " + KEY_NAME + " text not null, " + KEY_BODY + " text not null);"; Then you could change the names often and not encounter database create breakage.

This is exactly what I did. Still it crashes. I am stumped.

– user845528 Jul 15 at 4:52.

I guess problem is .. you are using KEY_NAME = "name"... Now as far as what I can see in your code that you are not creating a table in which you have 'name' coloumn. Now again might be you are trying to access value of name column which doesn't actually der in the table so it's throwing exception. But still a look to the Logcat (if you post here) can provide better answers to the problem.

Cheers!

Ok. I got the issue. I uninstalled the application from my phone and I reinstalled it.

And it works now. Any ideas why this works? – user845528 Jul 15 at 15:47 Probably the application has already created a table with different coloumn.So when you were accessing that table it was throwing error.

When you removed and reinstalled .. it just created a new table ...with the coloums you wanted. I guess this could be the reason – success_anil Jul 16 at 8:28.

This is a very basic question. I am just trying to understand how SQLite database works. So, here's what I do: In the code section below which is taken from notepad tutorial 3rd exercise, I change KEY_TITLE to KEY_NAME and all place I find title to name.

And the application crashes. Why does this happen?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions