Can I take a picture using the front camera on Samsung Galaxy Tab (Android 2.2) ?

回眸只為那壹抹淺笑 提交于 2019-12-24 16:03:27

问题


Can I take a picture from the front camera?

My application has an input form for inventory. If an user sends a data,
the user's face pic is also sent to the server for authorization / validation.

I will put the app on Samsung Galaxy Tab (Android 2.2).

Is there any way to take a picture from the front camera?


回答1:


For 2.2

    Camera cam = Camera.open();
    cam.setDisplayOrientation(90);
    cam.setPreviewDisplay(holder);

    Camera.Parameters para = cam.getParameters();
    para.set("camera-id", 2);
    cam.setParameters(p);



回答2:


To solve the error:

"The method open() is undefined for the type Camera"

import android.hardware.Camera 

This is instead of

import android.graphics.Camera

Both are given as options from eclipse only hardware one has open.



来源:https://stackoverflow.com/questions/6756998/can-i-take-a-picture-using-the-front-camera-on-samsung-galaxy-tab-android-2-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!