1

Hai to All Anybody know about the camera Api in android.when i used this Api it displayed a black and white grids and a squre moving above it.Anyone know how to get a real time camera preview please help me with some code.

Rajapandian
  • 7,059
  • 11
  • 37
  • 27
  • Are you in the emulator? Have you set the camera permission? That is the screen you get when there isn't a camera available. – hacken Jun 25 '09 at 06:54

3 Answers3

2

Also refer this Link

You are calling the last three lines too early. You have to wait for the surface to be prepared before calling setPreviewDisplay() and you have to wait for the surface to be sized (surfaceChanged()) before calling startPreview(). This project has what you need.

Community
  • 1
  • 1
1

You almost got the solution for the camera part, Check the code in the real device, i hope it would be working perfect in the device, since its the view from the emulator, you will be getting "white and black grids and a square moving above it." In the real device you will be getting the preview of what you are focusing on.

Nandagopal T
  • 2,037
  • 9
  • 42
  • 54
1

You are running your app on emulator, connect android based mobile to emulator and try it or copy that file into mobile and install it and then run it. It will definatly show camera m

Abhi
  • 116
  • 7