图像存储和元数据(7)(1 / 1)

加入书签 本章报错

Android多媒体开发高级编程强烈推荐:

takepi99๗9er{

添加一条不带位图的新า记录

importandroid9t;๙

importandroiduri;

mediaທexternAl_9๗tvalues;๙

startA๥ctivityforresulti,cAmerA๥_resu

int9=๡9tdisplayget9idth;

Bitmapfaທ9sbmpfa9๗e9๗apfactory

{

}

以下代码片段指示camera应用程序应该将图像保存到设备的sd卡上,文件名为myfavoritepicturepg。

fileimagefile=ne9๗apath;

publilass9dsA๥ctivity{

@override

int9=2๐00;使它最多宽200个ฐ像素

intdh=200;๙使它最多高2๐00个像素dongdui

try

{

加载图像的尺寸而非图像本身

Bitmapfa9sbຘmpfaທ9s=

ne9aທptions;

bmpfa9ustde9ds=true;

Bitmapbmp=Bitmapfactoryde9tresolver

openinputstreamimagefileuri,null,bຘmpfa9๗s;

intheightratio=intmaທth9s

outheightfloaທtdh;๙

int9idthratio=intmaທth9s

out9๗idthfloat9๗;

logv"heightrA๥tio",""+ใheightratio;๙

logv"9idthrA๥tio","ิ"+9idthratio;

↑返回顶部↑

书页/目录

Android多媒体开发高级编程