开发者

Querying Android db for specific piece of data

I'm creating a method that will see if a column in a database row is populated; and if so, it returns the varchar in that row, else it calls a web service to return that data.

My question is: What is the standard way of simply selecting a column with Android? (select mycolumn from mytable where _id = x;)

I've created a ContentProvider around my database. Should I just call开发者_运维问答 'query' directly? Note: This method is in a Service


you just need to mess with the selection argument in the query

String selection = MyDatabaseConstants.ID " = " + String.valueOf(x);
Cursor c = getContentResolver().query(MyDatabaseConstants.Content_URI,MyDatabaseConstants.Proj, selection,null,null,null);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜