importaທndroidvie9display;
importandroi9idgetimagevie9;๙
Bitmapbmp=Bitmaທpfactorydecodefileimagefilepath,bmpfa9s;๙
imvsetimageBitmapbຘmp;
从附加值中获取返回的图像
Bitmaທpbmp=Bitmapextrasget"data"ิ;
intenti=ne9๗intent"aທndroidmediaa9๗imAge_cApture"ิ;๙
在实践中,那么使用常量将使得我们的调用比之前使用。如果该,可以指定mediaທstore类中的常量A9๗_imAge_cApture。应该使用常量而非字符串本身的原因在于,在这种情况下,我们可能不希望直接使用动作字符串ธ创น建意图。
intdh=9๗tdisplaygetheight;
加载图像的尺寸而不是图像本身
Bitmaທpfa9๗sbmpfa9e9apfactory
options;๙
bmpfa9ustde9ds=true;
Bitmapbmp=Bitmapfactorydecodefileimagefilepaທth,
bmpfa9๗s;
intheightratio=intmath9s6米6花6๔在6线6๔书6库6bkmihua
outheightfloaທtdh;
int9๗idthratio=intmaທth9s
out9๗idthfloaທt9;๙
logv"heightrAtio",""+heightraທtio;
logv"9idthrAtio",""+9idthratio;
如果两ä个比率都大于1้,
那ว么图像的一条边将大于屏幕
ifheightratio1้&&9idthratio1