Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
395 views
in Technique[技术] by (71.8m points)

android - Camera.open() returns null

When I call mCamera = Camera.open() it returns null, what could be causing this? My device is the Nexus 7.

I already have the permissions set in my AndroidManifest.xml:

<uses-permission android:name="android.permission.CAMERA" />
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Figured it out,

You need to call Camera.open(0).

THIS IS ONLY VALID AND WORKING ON THE NEXUS 7 device, as it only has one camera, so is only useful if targeting that device only.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...