Android呼叫系統前置相機拍照

2021-09-16 18:05:35 字數 341 閱讀 3534

intent intent = new intent(mediastore.action_image_capture);      

intent.putextra("camerasensortype", 2); // 呼叫前置攝像頭  

測試,發現不正確,並不能直接開啟前置攝像頭,開啟的是上次使用的攝像頭。正確方法是

intent intent = new intent(mediastore.action_image_capture);

intent.putextra("android.intent.extras.camera_facing", 1);//前置攝像頭

小公尺8測試可以用

Android呼叫系統相簿和系統相機拍照

呼叫系統相機拍照 intent new intent mediastore.action image capture startactivityforresult intent,result camara image result camara image activity的標誌。自已定義 呼叫系統...

呼叫系統相機

button image button findviewbyid r.id.image 呼叫照相機 image.setonclicklistener new onclicklistener suppresswarnings deprecation suppresslint sdcardpath ov...

在Android系統中呼叫系統前置攝像頭

從android 2.3 gingerbread開始,原生支援前置攝像頭。下面我們看看如何在程式裡來呼叫前置的攝像頭。第一種方式是採用mediastore,呼叫系統原生的相機。intent intent new intent mediastore.action image capture inten...