當前位置: 首頁>>代碼示例>>Java>>正文


Java DatabaseUtils.dumpCursor方法代碼示例

本文整理匯總了Java中android.database.DatabaseUtils.dumpCursor方法的典型用法代碼示例。如果您正苦於以下問題:Java DatabaseUtils.dumpCursor方法的具體用法?Java DatabaseUtils.dumpCursor怎麽用?Java DatabaseUtils.dumpCursor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.database.DatabaseUtils的用法示例。


在下文中一共展示了DatabaseUtils.dumpCursor方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getDataColumn

import android.database.DatabaseUtils; //導入方法依賴的package包/類
/**
 * Get the value of the data column for this Uri. This is useful for
 * MediaStore Uris, and other file-based ContentProviders.
 *
 * @param context The context.
 * @param uri The Uri to query.
 * @param selection (Optional) Filter used in the query.
 * @param selectionArgs (Optional) Selection arguments used in the query.
 * @return The value of the _data column, which is typically a file path.
 * @author paulburke
 */
public static String getDataColumn(Context context, Uri uri, String selection,
								   String[] selectionArgs) {

	Cursor cursor = null;
	final String column = "_data";
	final String[] projection = {
			column
	};

	try {
		cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
				null);
		if (cursor != null && cursor.moveToFirst()) {
			if (DEBUG)
				DatabaseUtils.dumpCursor(cursor);

			final int column_index = cursor.getColumnIndexOrThrow(column);
			return cursor.getString(column_index);
		}
	} finally {
		if (cursor != null)
			cursor.close();
	}
	return null;
}
 
開發者ID:takyonxxx,項目名稱:AndroidSdrRtlTuner,代碼行數:37,代碼來源:FileUtils.java

示例2: getDataColumn

import android.database.DatabaseUtils; //導入方法依賴的package包/類
/**
 * Get the value of the data column for this Uri. This is useful for
 * MediaStore Uris, and other file-based ContentProviders.
 *
 * @param context       The context.
 * @param uri           The Uri to query.
 * @param selection     (Optional) Filter used in the query.
 * @param selectionArgs (Optional) Selection arguments used in the query.
 * @return The value of the _data column, which is typically a file path.
 * @author paulburke
 */
public static String getDataColumn(Context context, Uri uri, String selection,
                                   String[] selectionArgs) {

    Cursor cursor = null;
    final String column = "_data";
    final String[] projection = {
            column
    };

    try {
        cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
                null);
        if (cursor != null && cursor.moveToFirst()) {
            if (DEBUG)
                DatabaseUtils.dumpCursor(cursor);

            final int column_index = cursor.getColumnIndexOrThrow(column);
            return cursor.getString(column_index);
        }
    } finally {
        if (cursor != null)
            cursor.close();
    }
    return null;
}
 
開發者ID:rumaan,項目名稱:file.io-app,代碼行數:37,代碼來源:FileUtils.java

示例3: getDataColumn

import android.database.DatabaseUtils; //導入方法依賴的package包/類
public static String getDataColumn(Context context, Uri uri, String selection,
									   String[] selectionArgs) {

		Cursor cursor = null;
		final String column = "_data";
		final String[] projection = {
				column
		};

		try {
			cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
					null);
			if (cursor != null && cursor.moveToFirst()) {
//				if (DEBUG)
					DatabaseUtils.dumpCursor(cursor);

				final int column_index = cursor.getColumnIndexOrThrow(column);
				return cursor.getString(column_index);
			}
		} finally {
			if (cursor != null)
				cursor.close();
		}
		return null;
	}
 
開發者ID:Datatellit,項目名稱:xlight_android_native,代碼行數:26,代碼來源:FileUtils.java

示例4: getDataColumn

import android.database.DatabaseUtils; //導入方法依賴的package包/類
/**
 * Get the value of the data column for this Uri. This is useful for
 * MediaStore Uris, and other file-based ContentProviders.
 *
 * @param context The context.
 * @param uri The Uri to query.
 * @param selection (Optional) Filter used in the query.
 * @param selectionArgs (Optional) Selection arguments used in the query.
 * @return The value of the _data column, which is typically a file path.
 * @author paulburke
 */
public static String getDataColumn(Context context, Uri uri, String selection,
                                   String[] selectionArgs) {
    Cursor cursor = null;
    final String column = "_data";
    final String[] projection = {
            column
    };
    try {
        cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
                null);
        if (cursor != null && cursor.moveToFirst()) {
            if (DEBUG)
                DatabaseUtils.dumpCursor(cursor);
            final int column_index = cursor.getColumnIndexOrThrow(column);
            return cursor.getString(column_index);
        }
    } finally {
        if (cursor != null)
            cursor.close();
    }
    return null;
}
 
開發者ID:WorldBank-Transport,項目名稱:RoadLab-Pro,代碼行數:34,代碼來源:PathUtils.java

示例5: getDataColumn

import android.database.DatabaseUtils; //導入方法依賴的package包/類
/**
 * Get the value of the data column for this Uri. This is useful for
 * MediaStore Uris, and other file-based ContentProviders.
 *
 * @param context The context.
 * @param uri The Uri to query.
 * @param selection (Optional) Filter used in the query.
 * @param selectionArgs (Optional) Selection arguments used in the query.
 * @return The value of the _data column, which is typically a file path.
 * @author paulburke
 */
public static String getDataColumn(Context context, Uri uri, String selection,
                                   String[] selectionArgs) {

    Cursor cursor = null;
    final String column = "_data";
    final String[] projection = {
            column
    };

    try {
        cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
                null);
        if (cursor != null && cursor.moveToFirst()) {
            if (DEBUG)
                DatabaseUtils.dumpCursor(cursor);

            final int column_index = cursor.getColumnIndexOrThrow(column);
            return cursor.getString(column_index);
        }
    } finally {
        if (cursor != null)
            cursor.close();
    }
    return null;
}
 
開發者ID:Tourenathan-G5organisation,項目名稱:SiliCompressor,代碼行數:37,代碼來源:FileUtils.java

示例6: getDataColumn

import android.database.DatabaseUtils; //導入方法依賴的package包/類
/**
 * Get the value of the data column for this Uri. This is useful for
 * MediaStore Uris, and other file-based ContentProviders.
 *
 * @param context       The context.
 * @param uri           The Uri to query.
 * @param selection     (Optional) Filter used in the query.
 * @param selectionArgs (Optional) Selection arguments used in the query.
 * @return The value of the _data column, which is typically a file path.
 * @author paulburke
 */
public static String getDataColumn(Context context, Uri uri, String selection,
                                   String[] selectionArgs){

  Cursor cursor = null;
  final String column = "_data";
  final String[] projection = {
          column
  };

  try{
    cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
            null);
    if (cursor != null && cursor.moveToFirst()){
      if (DEBUG)
        DatabaseUtils.dumpCursor(cursor);

      final int column_index = cursor.getColumnIndexOrThrow(column);
      return cursor.getString(column_index);
    }
  }finally{
    if (cursor != null)
      cursor.close();
  }
  return null;
}
 
開發者ID:Nik-Sch,項目名稱:ChatApp-Android,代碼行數:37,代碼來源:FileUtils.java

示例7: getDataColumn

import android.database.DatabaseUtils; //導入方法依賴的package包/類
/**
 * Get the value of the data column for this Uri. This is useful for
 * MediaStore Uris, and other file-based ContentProviders.
 *
 * @param context       The context.
 * @param uri           The Uri to query.
 * @param selection     (Optional) Filter used in the query.
 * @param selectionArgs (Optional) Selection arguments used in the query.
 * @return The value of the _data column, which is typically a file path.
 * @author paulburke
 */
public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) {

    Cursor cursor = null;
    final String column = "_data";
    final String[] projection = {column};

    try {
        cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null);
        if (cursor != null && cursor.moveToFirst()) {
            if (DEBUG)
                DatabaseUtils.dumpCursor(cursor);

            final int column_index = cursor.getColumnIndexOrThrow(column);
            return cursor.getString(column_index);
        }
    } finally {
        if (cursor != null)
            cursor.close();
    }
    return null;
}
 
開發者ID:goodev,項目名稱:droidddle,代碼行數:33,代碼來源:FileUtils.java

示例8: getDataColumn

import android.database.DatabaseUtils; //導入方法依賴的package包/類
/**
 * Get the value of the data column for this Uri. This is useful for
 * MediaStore Uris, and other file-based ContentProviders.
 *
 * @param context The context.
 * @param uri The Uri to query.
 * @param selection (Optional) Filter used in the query.
 * @param selectionArgs (Optional) Selection arguments used in the query.
 * @return The value of the _data column, which is typically a file path.
 */
public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) {
    final String column = "_data";
    final String[] projection = {
        column
    };

    Cursor cursor = null;
    try {
        cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null);
        if (cursor != null && cursor.moveToFirst()) {
            if (DEBUG) {
                DatabaseUtils.dumpCursor(cursor);
            }
            final int columnIndex = cursor.getColumnIndex(column);
            return columnIndex < 0 ? null : cursor.getString(columnIndex);
        }
    } finally {
        if (cursor != null) cursor.close();
    }
    return null;
}
 
開發者ID:TomeOkin,項目名稱:LsPush,代碼行數:32,代碼來源:MimeTypeUtils.java

示例9: getDataColumn

import android.database.DatabaseUtils; //導入方法依賴的package包/類
/**
 * Get the value of the data column for this Uri. This is useful for
 * MediaStore Uris, and other file-based ContentProviders.
 *
 * @param context The context.
 * @param uri The Uri to query.
 * @param selection (Optional) Filter used in the query.
 * @param selectionArgs (Optional) Selection arguments used in the query.
 * @return The value of the _data column, which is typically a file path.
 * @author paulburke
 */
public static String getDataColumn(Context context, Uri uri, String selection,
        String[] selectionArgs) {

    Cursor cursor = null;
    final String column = "_data";
    final String[] projection = {
            column
    };

    try {
        cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
                null);
        if (cursor != null && cursor.moveToFirst()) {
            if (DEBUG)
                DatabaseUtils.dumpCursor(cursor);

            final int column_index = cursor.getColumnIndexOrThrow(column);
            return cursor.getString(column_index);
        }
    } finally {
        if (cursor != null)
            cursor.close();
    }
    return null;
}
 
開發者ID:dc914337,項目名稱:PSD-Android-App,代碼行數:37,代碼來源:FileUtils.java

示例10: getDataColumn

import android.database.DatabaseUtils; //導入方法依賴的package包/類
/**
 * Get the value of the data column for this Uri. This is useful for
 * MediaStore Uris, and other file-based ContentProviders.
 *
 * @param context       The context.
 * @param uri           The Uri to query.
 * @param selection     (Optional) Filter used in the query.
 * @param selectionArgs (Optional) Selection arguments used in the query.
 * @return The value of the _data column, which is typically a file path.
 */
public static String getDataColumn(Context context, Uri uri, String selection,
                                   String[] selectionArgs) {

    Cursor cursor = null;
    final String column = "_data";
    final String[] projection = {
            column
    };

    try {
        cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
                null);
        if (cursor != null && cursor.moveToFirst()) {
            if (DEBUG)
                DatabaseUtils.dumpCursor(cursor);

            final int column_index = cursor.getColumnIndexOrThrow(column);
            return cursor.getString(column_index);
        }
    } finally {
        if (cursor != null)
            cursor.close();
    }
    return null;
}
 
開發者ID:NaikSoftware,項目名稱:NaikSoftware-Lib-Android,代碼行數:36,代碼來源:FileUtils.java

示例11: getDataColumn

import android.database.DatabaseUtils; //導入方法依賴的package包/類
/**
 * Get the value of the data column for this Uri. This is useful for
 * MediaStore Uris, and other file-based ContentProviders.
 *
 * @param context The context.
 * @param uri The Uri to query.
 * @param selection (Optional) Filter used in the query.
 * @param selectionArgs (Optional) Selection arguments used in the
 *        query.
 * @return The value of the _data column, which is typically a
 *         file path.
 * @author paulburke
 */
public static String getDataColumn(Context context, Uri uri,
                                   String selection,
                                   String[] selectionArgs)
{

    Cursor cursor = null;
    final String column = "_data";
    final String[] projection =
    {
        column
    };

    try
    {
        cursor = context.getContentResolver()
            .query(uri, projection, selection, selectionArgs, null);
        if (cursor != null && cursor.moveToFirst())
        {
            if (DEBUG)
                DatabaseUtils.dumpCursor(cursor);

            final int column_index = cursor.getColumnIndexOrThrow(column);
            return cursor.getString(column_index);
        }
    }
    finally
    {
        if (cursor != null)
            cursor.close();
    }
    return null;
}
 
開發者ID:billthefarmer,項目名稱:diary,代碼行數:46,代碼來源:FileUtils.java

示例12: getDataColumn

import android.database.DatabaseUtils; //導入方法依賴的package包/類
/**
 * Get the value of the data column for this Uri. This is useful for MediaStore Uris, and other
 * file-based ContentProviders.
 *
 * @param context The context.
 * @param uri The Uri to query.
 * @param selection (Optional) Filter used in the query.
 * @param selectionArgs (Optional) Selection arguments used in the query.
 * @return The value of the _data column, which is typically a file path.
 */
public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs)
{

	Cursor cursor = null;
	final String column = "_data";
	final String[] projection = { column };

	try
	{
		cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null);
		if(cursor != null && cursor.moveToFirst())
		{
			if(DBG)
				DatabaseUtils.dumpCursor(cursor);

			final int column_index = cursor.getColumnIndexOrThrow(column);
			return cursor.getString(column_index);
		}
	}
	catch(IllegalArgumentException ex)
	{
		Log.e(TAG, "getDataColumn: _data", ex);
	}
	finally
	{
		if(cursor != null)
			cursor.close();
	}
	return null;
}
 
開發者ID:KAlO2,項目名稱:PerfectShow,代碼行數:41,代碼來源:FileUtils.java

示例13: buildUrl

import android.database.DatabaseUtils; //導入方法依賴的package包/類
private String buildUrl(TaskParams params) throws UnsupportedEncodingException {
    ContentResolver resolver = mContext.getContentResolver();
    if (params.getTag().equals(StockIntentService.ACTION_INIT)
            || params.getTag().equals(TAG_PERIODIC)) {
        mIsUpdate = true;
        Cursor cursor = resolver.query(QuoteProvider.Quotes.CONTENT_URI,
                new String[]{"Distinct " + QuoteColumns.SYMBOL}, null,
                null, null);

        if (cursor != null && cursor.getCount() == 0 || cursor == null) {
            // Init task. Populates DB with quotes for the symbols seen below
            return INIT_QUOTES;
        } else {
            DatabaseUtils.dumpCursor(cursor);
            cursor.moveToFirst();
            for (int i = 0; i < cursor.getCount(); i++) {
                mStoredSymbols.append("\"");
                mStoredSymbols.append(cursor.getString(
                        cursor.getColumnIndex(QuoteColumns.SYMBOL)));
                mStoredSymbols.append("\",");
                cursor.moveToNext();
            }
            mStoredSymbols.replace(mStoredSymbols.length() - 1, mStoredSymbols.length(), "");
            return mStoredSymbols.toString();
        }
    } else if (params.getTag().equals(StockIntentService.ACTION_ADD)) {
        mIsUpdate = false;
        // Get symbol from params.getExtra and build query
        String stockInput = params.getExtras().getString(StockIntentService.EXTRA_SYMBOL);
        return "\"" + stockInput + "\"";
    } else {
        throw new IllegalStateException("Action not specified in TaskParams.");
    }
}
 
開發者ID:DmitryMalkovich,項目名稱:stock-hawk-app,代碼行數:35,代碼來源:StockTaskService.java

示例14: getDataColumn

import android.database.DatabaseUtils; //導入方法依賴的package包/類
/**
 * Get the value of the data column for this Uri. This is useful for
 * MediaStore Uris, and other file-based ContentProviders.
 *
 * @param context The context.
 * @param uri The Uri to query.
 * @param selection (Optional) Filter used in the query.
 * @param selectionArgs (Optional) Selection arguments used in the query.
 * @return The value of the _data column, which is typically a file path.
 * @author paulburke
 */
public static String getDataColumn(Context context, @Nullable Uri uri, @Nullable String selection,
		@Nullable String[] selectionArgs) {

	Cursor cursor = null;
	final String column = "_data";
	final String[] projection = {
		column
	};

	try {
		cursor = context.getContentResolver().query(uri, projection, selection,
				selectionArgs, null);
		if (cursor != null && cursor.moveToFirst()) {
			if (DEBUG)
				DatabaseUtils.dumpCursor(cursor);

			final int column_index = cursor.getColumnIndexOrThrow(column);
			return cursor.getString(column_index);
		}
	} catch (Exception e) {
		// SecurityException  in the wild
		return null;
	} finally {
		if (cursor != null)
			cursor.close();
	}
	return null;
}
 
開發者ID:vuze,項目名稱:vuze-remote-for-android,代碼行數:40,代碼來源:PaulBurkeFileUtils.java

示例15: getDataColumn

import android.database.DatabaseUtils; //導入方法依賴的package包/類
/**
 * Get the value of the data column for this Uri. This is useful for
 * MediaStore Uris, and other file-based ContentProviders.
 *
 * @param context The context.
 * @param uri The Uri to query.
 * @param selection (Optional) Filter used in the query.
 * @param selectionArgs (Optional) Selection arguments used in the query.
 * @return The value of the _data column, which is typically a file path.
 * @author paulburke
 */
public static String getDataColumn(Context context, Uri uri, String selection,
        String[] selectionArgs) {

    Cursor cursor = null;
    final String column = "_data";
    final String[] projection = {
            column
    };

    try {
        cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
                null);
        if (cursor != null && cursor.moveToFirst()) {
            if (DEBUG)
                DatabaseUtils.dumpCursor(cursor);

            final int column_index = cursor.getColumnIndexOrThrow(column);
            return cursor.getString(column_index);
        }
    } catch (Exception e) {
        Log.w(TAG, "Error getting data column", e);
    } finally {
        if (cursor != null)
            cursor.close();
    }
    return null;
}
 
開發者ID:ngageoint,項目名稱:geopackage-mapcache-android,代碼行數:39,代碼來源:FileUtils.java


注:本文中的android.database.DatabaseUtils.dumpCursor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。