开发者

Android: Text primary key with different name

开发者 https://www.devze.com 2023-01-03 12:39 出处:网络
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 na

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消