Example usage for android.database.sqlite SQLiteConstraintException initCause

List of usage examples for android.database.sqlite SQLiteConstraintException initCause

Introduction

In this page you can find the example usage for android.database.sqlite SQLiteConstraintException initCause.

Prototype

public synchronized Throwable initCause(Throwable cause) 

Source Link

Document

Initializes the cause of this throwable to the specified value.

Usage

From source file:com.appsimobile.appsii.module.home.provider.HomeContentProvider.java

@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {

    SqlArguments args = new SqlArguments(uri, selection, selectionArgs);

    SQLiteDatabase db = mOpenHelper.getWritableDatabase();

    try {//from  ww w.jav a 2 s.com
        int count = db.delete(args.table, args.where, args.args);

        if (count > 0)
            sendNotify(uri);
        return count;
    } catch (SQLiteConstraintException e) {
        SQLiteConstraintException ex = new SQLiteConstraintException(
                "Constraint violation on delete of: " + uri);
        ex.initCause(e);
        throw ex;
    }
}