質問

I tried to use a CursorLoader but I don't understand how fill in parameters.

For my application I need to watch in one column if the value is false and get the id of this row.

     String[] projection = { 
         TableLifetouchRespirationRate.COLUMN_ACKNOWLEDGMENT_MESSAGE
         };        


Context context = this;
Uri uri = IsansysPatientGatewayContentProvider.CONTENT_URI_RESPIRATION_RATES;
String selection = TableLifetouchRespirationRate.COLUMN_ACKNOWLEDGMENT_MESSAGE ;
String[] selectionArgs = null;
String sortOrder = null;

    cursorLoader = new CursorLoader(context, uri, projection, selection + "=?", selectionArgs, sortOrder);

In SQL it look like this:

SELECT id FROM TableLifetouchRespirationRate WHERE acknolegment_message = false

Could you give me an example to use a cursor loader?

役に立ちましたか?

解決

I found my myself :)

    Context context = this;
// URI table
Uri uri = IsansysPatientGatewayContentProvider.CONTENT_URI_RESPIRATION_RATES;
// URI columns to get from table class
String[] projection = { 
        TableLifetouchRespirationRate.COLUMN_ID, 
        TableLifetouchRespirationRate.COLUMN_LIFETOUCH_ID, 
        TableLifetouchRespirationRate.COLUMN_RESPIRATION_RATE,
        TableLifetouchRespirationRate.COLUMN_ACKNOWLEDGMENT_MESSAGE, 
        TableLifetouchRespirationRate.COLUMN_TIMESTAMP,
        TableLifetouchRespirationRate.COLUMN_SESSION_NUMBER
        };       
// In the column ACKNOWLEDGMENT_MESSAGE...
String selection = TableLifetouchRespirationRate.COLUMN_ACKNOWLEDGMENT_MESSAGE  + "=?"; 
// Select rows = "0" (it is possible to add augments on several columns)
String[] selectionArgs = {"0"};
String sortOrder = null;

cursorLoader = new CursorLoader(context, uri, projection, selection, selectionArgs, sortOrder);

Have fun!

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top