I have an existing Windows app for which I'm writing an Android port. The app uses a unique string as the primary key, but the SQLite methods in Android all seem to work with integers and a column names _id, whereas my ID column isn't called this. Is there a way to let Android know I have a key with a different column name?
+2
A:
Is there a way to let Android know I have a key with a different column name?
No.
So long as you avoid the use of CursorAdapter
, I think you will be OK. Otherwise, you will need to create a separate unique _ID
integer column. You don't necessarily need to use that as a primary key, but CursorAdapter
and friends will want it.
CommonsWare
2010-06-13 14:23:15
I eventually went with Android's naming scheme. There werre some good tips at http://stackoverflow.com/questions/1122679/android-sqllite-tips
Echilon
2010-06-14 19:34:03