zoukankan      html  css  js  c++  java
  • 整理

    //调用系统相机
    Intent i=new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
    startActivityFroResult(i,requestCode) 注意使用startActivity没有图片信息返回


    重写OnActicityResult

    if(resultCode==RESULT_OK){
    Bundle extras=intent.getExtras();
    Bitmap bmp=(Bitmap) extrast.get("data");//获得返回的图片对象
    }

    这样返回的是缩略图

    可以通过给定位置来放置原图
    Uri imgFileUrl=Uri.fromFile(文件名称);
    i.putExtra(android.provider.MediaStore.EXTRA_OUTPUT,uri);
    在startActivityFroResult(i,requestCode) 之前添加上面代码


    BitmapFactory.Options设置加载图片的设置类
    例如:inSampleSize=2,返回原始图像大小的二分之一

    图像的标准内容提供器是MediaStore


    Uri imgFileUrl=getContentResolver().insert(Media.EXTERNAL_CONTENT_URL,new ContentValues());
    Intent i=new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
    i.putExtra(android.provider.MediaStore.EXTRA_OUTPUT,imgFileUrl);
    startActivityFroResult(i,requestCode)

    Bitmap bmp=BitmapFactory.decodeStream(getContentResolver().openInputStream(imgFileUrl),null,bmpFactoryOptions);

    更新图片数据
    getContentResolver().update(uri,new ContentValues(),null,null);


    EXIF表示可交换的图像文件格式,它是在图像文件中保存元数据的一种标准方式。
    读取EXIF数据
    ExifInterface ei=new ExifInterface(imageFilePath);
    ei.getAttribute(属性);//例如imageDescription
    保存EXIF数据
    ei.setAttribute("属性",值);
    www.cipa.jp/english/hyoujunka/kikaku/pad/DC-008-2010_E.pdf

  • 相关阅读:
    MySQL教程22-字符串类型
    MySQL教程21-日期和时间类型
    MySQL教程20-小数类型
    MySQL教程19-整数类型
    MySQL教程18-数据类型简介
    ActiveMQ_topic
    ActiveMQ_消费者编码
    ActiveMQ_生产者编码
    ActiveMQ介绍
    管理docker容器
  • 原文地址:https://www.cnblogs.com/jason-star/p/3738170.html
Copyright © 2011-2022 走看看