Anyway to place camera preview onto xml defined surfaceview?

by chrispix » Tue, 16 Dec 2008 06:05:13 GMT

Sponsored Links
 I have been messing with the issue for days to try and place the
camera preview onto a surfaceview defined in my xml layout. Main
reason I am trying to do this is to place it onto a tabview.

used to tie to the surface view to paint.
So on the Preview API  example, if I changed it from
mHolder = getHolder();
SurfaceView mysurfaceview = (SurfaceView)findViewById
mHolder = mysurfaceview.getHolder;

My app compiles fine, but crashes @ runtime.

That should work, but I don't think I have seen an application YET
where the camera preview is loaded onto a SurfaceView. I am able to
resize the preview using the width and height, but that does not
really help as I can't seem to position the view where I need it to


Other Threads

1. Apllication not installing in Sony Xperia


I made an android application in 1.6 SDK. It works in all devices,
which includes HTC Tattoo, LG, Samsung Galaxy, Motorola Droid and
Nexus one. But in Sony Xperia, firmware is 1.6. When I try to install
its getting the error, "Application cannot be installed". Any idea ??



2. Issue with GPS Droid, Hero CDMA


I am developing an app which uses GPS to find current location. ASAP I
get location I shut down GPS listener..For some of the phones like
droid, hero on CDMA, it is not getting closed. Following is the code

final String currentProvider = LocationManager.GPS_PROVIDER;
                        if(locManager.isProviderEnabled(currentProvider)) {

                                HandlerThread mThread = new HandlerThread("GPS 
                                new Handler(mThread.getLooper()).post (
                                        new Runnable() {
                                        public void run() {
locManager.requestLocationUpdates(currentProvider, 1L, 0.0f,
                                currentLocation =
                                try {
                                        if(currentLocation != null) {

                                        // Do anything with current location.

                                } catch (Exception e) {

                                } finally {
                                        try {
                                                if (locManager != null) {
                                                if (mThread != null) {

                                        } catch (Exception e) {


Even though I am calling removeUpdate() it keeps gps icon on
notification bar. What am I doing wrong?

Thanks in advance..



3. android support microosoft exchange?

4. Fw: Delivery Status Notification (Failure)

5. Applying animation to all the items in the list at once

6. Getting the amount of Audio data buffered in the device

7. How to come back main activity from child activity