tags:

views:

183

answers:

2

Hello!

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?

+1  A: 

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

gnobal
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
+1  A: 

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

Sean Owen
I added camera=null (besides camera.release and camera.stoppreview) to surfaceDestroyed and now it's working so far.
DixieFlatline