2

Every Body, I am new in android world.So i need your help.

I Want to know that how we can open camera activity in selected area. In such a manner-

AS in given below screen-shot. It is not compulsory to open in circular area, in my app i can open in any customize area either may be circular , rectangular or in square shape:

enter image description here

Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
john
  • 359
  • 1
  • 4
  • 15

2 Answers2

1

You have to use SurfaceView

In this page you can see an example: SurfaceViewExample

frayab
  • 2,512
  • 20
  • 25
0

You need surface holder and a surface view in your activity. If you need some explanation then check Android Camera Surface View link hope it will help you. Any doubt you can ask I will try to explain it.

Community
  • 1
  • 1
Bharat Sharma
  • 3,926
  • 2
  • 17
  • 29
  • A simple layout i am creating in code so you need not to worry about XML. If you want to create layout in XML then simply use VideoView and typecast it in surfaceview (super class of video view) it will work. – Bharat Sharma Dec 19 '12 at 11:12
  • camera = Camera.open(); camera.setPreviewDisplay(holder); Both above line show error for me.....// the method open() is undefined for type camera and same for setPreviewDisplay(holder)..... So in that case what should i do... please help me.... – john Dec 20 '12 at 04:50
  • which android version you are using – Bharat Sharma Dec 20 '12 at 05:26
  • for android 2.3 and above Camera.Open(camera_index) will be used as it supports multiple camearas(front and back camera) so pass either 0 or 1 as camera index. – Bharat Sharma Dec 20 '12 at 05:29