get Bitmap By Database Cursor - Android Database

Android examples for Database:Cursor Get

Description

get Bitmap By Database Cursor

Demo Code


//package com.java2s;

import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class Main {
    public static Bitmap getBitmapByCursor(Cursor c, int index) {
        byte[] data = c.getBlob(index);
        try {//  w  w w  .  j a  v  a 2  s  .com
            return BitmapFactory.decodeByteArray(data, 0, data.length);
        } catch (Exception e) {
            return null;
        }
    }
}

Related Tutorials