zoukankan      html  css  js  c++  java
  • android图片保存到SQLlite如何实现?

    //写入数据库  
         
            ImageView pic = (ImageView) findViewById(R.id.picture);
                                            Bitmap picdraw =pic.getDrawingCache(true)
    picdraw.compress(Bitmap.CompressFormat.PNG, 100, os);
    values.put("pic", os.toByteArray());

                                            //从数据库读取

                                            BitmapFactory.Options opts = new BitmapFactory.Options();  
    opts.inJustDecodeBounds = true;  
    BitmapFactory.decodeByteArray(c.getBlob(c.getColumnIndex("pic")), 0, c.getBlob(c.getColumnIndex("pic")).length,opts); 
    opts.inSampleSize = Common.computeSampleSize(opts, -1, 130*100);  
    opts.inJustDecodeBounds = false;
    bmp = BitmapFactory.decodeByteArray(c.getBlob(c.getColumnIndex("pic")), 0, c.getBlob(c.getColumnIndex("pic")).length,opts);

                                            

  • 相关阅读:
    2018.7.9 模拟赛
    树状数组||归并排序求逆序对+离散化 nlogn
    LCS nlogn
    孤岛营救问题
    [POJ 3621] Sighting Cows
    树状数组求LIS
    nlogn求逆序对&&陌上花开
    最长可重区间集
    LCA模板
    [BZOJ] 4196 [Noi2015]软件包管理器
  • 原文地址:https://www.cnblogs.com/mochaMM/p/5110217.html
Copyright © 2011-2022 走看看