Android Context Delete deleteContentUri(Context ctx, Uri contentUri, String idColumn)

Here you can find the source of deleteContentUri(Context ctx, Uri contentUri, String idColumn)

Description

Utility method for deleting all the elements from a given content URI.

License

Open Source License

Parameter

Parameter Description
ctx the context whose content resolver to use to lookup the URI
contentUri the content URI to delete all the items from
idColumn the column of the primary key for the URI

Declaration

private static void deleteContentUri(Context ctx, Uri contentUri,
        String idColumn) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import android.content.Context;

import android.net.Uri;

public class Main {
    /**/*from  w w w  .  ja  v  a  2 s .  co m*/
     * Utility method for deleting all the elements from a given content URI. You have to provide the name of the primary key column.
     * @param ctx the context whose content resolver to use to lookup the URI
     * @param contentUri the content URI to delete all the items from
     * @param idColumn the column of the primary key for the URI
     */
    private static void deleteContentUri(Context ctx, Uri contentUri,
            String idColumn) {
        ctx.getContentResolver().delete(contentUri, null, null);
    }
}