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开发者_如何学C name?
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.
精彩评论