1

I have a strange problem on my htc hero. When launching camera, i get out of memory exception. After that, if i launch any other application that uses camera, they also crash(when trying to use camera function). I call camera.release and camera.stoppreview in surfacedestroyed function, but that doesnt help.

What is the right way to release all resources? Could somebody please show his working surfacechanged, surfacecreated and surfacedestroyed functions? I have empty onPreviewFrame function, should i put something there?

DixieFlatline
  • 7,895
  • 24
  • 95
  • 147
  • I forgot to ask where should i put my parameters(previewsize,pictureformat,previewformat....)? In surfaceCreated() or in surfaceChanged()? Thank you – DixieFlatline Apr 26 '10 at 14:28

2 Answers2

1

How about this search for "surfacechanged" in Google Code Search? The first result is from the Android source code.

gnobal
  • 18,309
  • 4
  • 30
  • 35
  • Sorry but i can't see what should be done. I think google should put a tutorial to this site http://developer.android.com/guide/topics/graphics/2d-graphics.html , because everything is explained quite well, except for the camera which is quite important. – DixieFlatline Apr 26 '10 at 15:05
1

Look at the source code to Barcode Scanner. Look at what it does with onPause() and onResume(), via CameraManager.

Sean Owen
  • 66,182
  • 23
  • 141
  • 173