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();
mHolder.addCallback(this);
mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
to
SurfaceView mysurfaceview = (SurfaceView)findViewById
(R.id.SurfaceView01);
mHolder = mysurfaceview.getHolder;
mHolder.addCallback(this);
mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);

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
be.


--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Apllication not installing in Sony Xperia

Hi,

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 ??

Nithin


-- 

2. Issue with GPS Droid, Hero CDMA

Hi,

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
snipset..

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


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

                                        // Do anything with current location.

                                        }
                                } catch (Exception e) {

                                } finally {
                                        try {
                                                if (locManager != null) {
                                                        
locManager.removeUpdates(this);
                                                }
                                                if (mThread != null) {
                                                        
mThread.getLooper().quit();
                                                }

                                        } catch (Exception e) {

                                        }
                                }
                        }

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

Thanks in advance..

Namrata

-- 

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