Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.content.Context;

import android.net.Uri;

public class Main {
    /****
     * Remove audio file that is existing on the device.
     * 
     * @param ctx
     *            {@link Context}
     * @param uri
     *            {@link Uri} of the audio file
     * 
     * @throws NullPointerException
     *             if the Uri parameter is null
     * */
    public static boolean removeAudio(Context ctx, Uri uri) {

        if (uri == null) {
            throw new NullPointerException("Uri cannot be null");
        }

        return (ctx.getContentResolver().delete(uri, null, null) != 0);
    }
}