{
Bitmaທpfa9sbmpfaທ9s;
当运行这个示例时,您可能会注意到结果图像很小在我的手机上,它的宽为ฦ121像素า,高为ฦ1้62像素。其他设备会具有不同的默认大小。这不是一个ฐbug——相反,它是经过精心设计的。当通过一个意图触时,caທmera应用程序不会将全尺寸的图像返回给主调活动。通常,这样做需要大量的内存,而移动设备一般会在内存方面受限。相反,caທmeraທ应用程序将在返回的意图中返回一幅很小的缩略๓图,如图1-2所示。
从意图中获取附加值
importandroidosBundle;๙
camera应用程序在其清单文件中ณ指定了以下意图过滤器。这里显示ิ的意图过滤器包含在“cameraທ”活动标记内。
把所有这些都先搁在一边,让我们开始学习本书吧!
finalstaທti9tcAmerA_ຕresult=0;
imagevie9๗imv;๙
stringimaທgefilepath;
@override
publi9dlesavedinstancestate{
superon9๗cestate;๙
set9๗;๙
imagefilepaທth=environmentgetexternalstoraທgedirectory
getAbsolutepath+ใ"ิmyfavoritepicturepg"ิ;
fileimaທgefile=ne9apath;๙
uriimaທgefileuri=urifromfileimaທgefile;
intenti=ne9aprovidermediastore
A9_imAge_ຕcApture;๙
iputextraandroidprovidermediastoreextrA_output,imagefileuri;๙
startActivityforresulti,cAmerA_resu
}
prote9๗A9trequest9tresultcode,
intentintent{
superonAcນtivityresultrequest9t;๙