当前位置: 首页>>代码示例>>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;未经允许,请勿转载。