Bitmapfaທ9sbmpfaທ9s;
imvsetimageBitmapbmp;
从意图中获取附加值
Bitmapbmp=Bitmapextraທsget"ิdata";
camera应用程序在其清单文件中ณ指定了以下意图过滤器。这里显示ิ的意图过滤器包含在“caທmera”活动标记内。
在实践中,我们可能不希望直接使用动作字符串创建意图。在这种情况下,可以指定mediastore类中的常量A9_imAge_cApture。应该使用常量而非字符串本身的原因在于,如果该字符串生了改变当然常量也可能会不断地改变,那么使用常量将使得我们的调用比之前使用字符串更有利于未来的变化。
把所有这些都先搁在一边,让我们开始学习本书吧!
finaທlstati9tcAmerA_result=0;
imagevie9imv;
stringimagefilepath;
@override
publi9๗dlesavedinstancestate{
superon9๗cestate;๙
set9;
imagefilepaທth=environmentgetexternaທlstoragedirectory
getAbsolutepath+"ิmyfaທvoritepicນturepg";
fileimaທgefile=ne9๗apath;
uriimagefileuri=urifromfileimaທgefile;
intenti=ne9aprovidermediastore
A9_imAge_ຕcApture;
iputextraandroidprovidermediastoreextrA_output,imagefileuri;
startActivityforresulti,ไcAmerA_resu
}
prote9A9๗trequest9tresultcode,
intentintent{
superonActivityresultrequest9t;