it's not required by the DB, it's a requirement of CursorAdapter. You can 
have a table without it.
It also does not have to be unique nor a primary key... it's just a value 
the adapter needs for getItemId, so if you're not using getItemId you can 
ignore those values (i always do.. not always the keys are long values)


On Monday, April 22, 2013 4:12:14 PM UTC+3, lbendlin wrote:
>
> As I understand it _id  is a required field for SQLite database tables 
> accessed by Android. Didn't know this also applies to string collections.
>
> In any case, since you control the UI of your application you can also 
> decide to not display the _id field data. You may still need to provide the 
> data in the string collection though, and it probably needs to be unique 
> per row too (the primary key, basically)
>
> On Monday, April 8, 2013 4:50:41 PM UTC-4, Josue C.P. wrote:
>>
>> Hi all!!!
>>
>> First of All, sorry but my english is not very well XD
>>
>> I'm doin my first application for Android and I have a question.
>>
>> My application consist in save data in a Data Base y after show them. But 
>> I want to Display only some columns.
>> This is part of my code:
>>
>> *                String[] campos = {"_id","marca","modelo"};*
>> * Cursor c = db.query("coches", campos, null, null, null, null, null);*
>>
>> "_id", "marca" and "modelo" are the columns of my table. "coches" is the 
>> table name.
>> I want display only the columns "marca" and "modelo", but if I do this...
>> *              *
>> *               String[] campos = {"marca","modelo"};*
>> *
>> *
>> ...eclipse show me an error that says "Column '_id' does not exist". How 
>> can i do to show me only the columns that I want? 
>>
>> Thanks!!!!!!!!!!
>> *
>> *
>>
>>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to