Android Context Get findOne(Context context, Uri uri)

Here you can find the source of findOne(Context context, Uri uri)


find One


public static ContentValues findOne(Context context, Uri uri) 

Method Source Code

//package com.java2s;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.util.Log;

public class Main {
    private static String TAG = "AlarmUtils";

    public static ContentValues findOne(Context context, Uri uri) {
        if (context == null) {
            Log.e(TAG, "findOne: cannot get context");
            return null;
        }/*from w  ww.  j  av  a 2  s  . c  o m*/
        Cursor cursor = context.getContentResolver().query(uri, null, null,
                null, null);
        if (cursor == null || !cursor.moveToFirst()) {
            Log.e(TAG, String.format("findOne: alarm %s not found", uri));
            return null;
        ContentValues alarm = new ContentValues();
        DatabaseUtils.cursorRowToContentValues(cursor, alarm);
        return alarm;


  1. getBitmapFromAssert(Context thisContext, String name)
  2. getString(Context context, int id)
  3. getString(Context context, int resId, Map replacement)
  4. getStringFromXml(Context context, int resId)
  5. getBoolean(ContentValues alarm, String key)
  6. getCurrentTimeString(Context aContext, long aDate)
  7. getCurrentTimeString(Context context)
  8. readRaw(Context ctx, int res_id)
  9. loadImageFromAsset(Context context, String id)