Android SDK Demos

The Android SDK has a demo version of the API for previewing the camera. However, this gives me an exception at runtime in the emulator. I have been working with Eclipse on Mac since 10.6

Here is the link where I grabbed the code:

http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/CameraPreview.html

+3
source share
5 answers

Make sure you set permissions in the AndroidManifest.xml file to use the camera. Place this line above the application tag.

<uses-permission android:name="android.permission.CAMERA" />
+7
source

I have things to work with my Nexus One.

"", API . Android Camera:

https://android.googlesource.com/platform/packages/apps/Camera

, , . SurfaceChanged startPreview. .

+4

NexusOne.

Corey Trager, , ApiDemos, 2.1 SDK.

, , - CameraPreview

public void surfaceChanged(SurfaceHolder holder, int format, int w, int h){..}

:

parameters.setPreviewSize(w,h);

parameters.setPreviewSize(352,288);

, Dev1S G1.

0
source

you can use

List<Camera.Size> getSupportedPreviewSizes ()

And select a size from the list

0
source

This issue is also mentioned in Google Android Android , and it may be useful for you, the code mentioned below in one comment as a possible solution to solve preview problems.

0
source

Source: https://habr.com/ru/post/1730311/


All Articles