使用内置的Camera应用程序捕获图像(7)(1 / 1)

加入书签 本章报错

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

Bitmapfaທ9sbmpfaທ9s;

imvsetimageB๦itmapbmp;

从意图中获取附加值

Bitmapbmp=๡Bitmapextraທsget"ิdata";

camera应用程序在其清单文件中ณ指定了以下意图过滤器。这里显示ิ的意图过滤器包含在“caທmera”活动标记内。

在实践中,我们可能不希๶望直接使用动作字符串创建意图。在这种情况下,可以指定mediastore类中的常量A9_imAge_cA๥pture。应该使用常量而非字符串本身的原因在于,如果该字符串生了改变当然常量也๣可能会不断地改变,那么使用常量将使得我们的调用比之前使用字符串更有利于未来的变化。

把所有这些都先搁在一边,让我们开始学习本书๰吧!

finaທlstati9tcAmerA_result=0;

imagevie9imv;

stringimagefilepath;

@๤override

publi9๗dlesavedinstancestate{

superon9๗cestate;๙

set9;

imagefilepaທth=environmentgetexternaທlstoragedirectory

getA๥bsolutepath+"ิmyfaທvoritepicນturepg";

fileimaທgefile=ne9๗apath;

uriimagefileuri=urifromfileimaທgefile;

intenti=๡ne9aprovidermediastore

A๥9_imAge_ຕcApture;

iputextraandroidprovidermediastoreextrA_output,imagefileuri;

startActivityforresulti,ไcAmerA_resu

}

prote9A9๗trequest9tresultcode,

intentintent{

superonActivityresultrequest9t;

↑返回顶部↑

书页/目录

Android多媒体开发高级编程