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. Question about Canvas


I'm new to android and I analyse example codes like Snake at the
moment to get a better feeling for android development. The most parts
are clear for me, but there is something I don't understand yet. In
this example there is the following code example:

    public void loadTile(int key, Drawable tile) {
        Bitmap bitmap = Bitmap.createBitmap(mTileSize, mTileSize,
        Canvas canvas = new Canvas(bitmap);
        tile.setBounds(0, 0, mTileSize, mTileSize);

        mTileArray[key] = bitmap;

So every time a loadTile is executed (this is not just once) a new
Canvas will be created. What is the sense of more than one canvas? I
thought that a canvas is some kind of layer whereon you have to draw.
But obviously they instance multiple canvases. Is my thought about
what a canvas is wrong? In my opinion I only need one canvas. I
already wrote some testcode with a thread, a bouncing ball and a
background and I have only drawn to one canvas. So why do they use
more than one canvas?



2. let Android compiling javascript


Is it possible let Android it self compile javascript language rather
than use browser?


i open a API that can create or edit javascript like below

// javascript code
alert("Hello Android");

and execute it.

than i can see a small window with "Hello Android" in there just like
a browser did.



3. Problem in Showing TXT file in Webview

4. GLSurfaceView given to a PopupWindow trouble (is it possible??)

5. Android Drm provider and forward locking

6. AudioRecord on Emulator with friquency > 8 kHz

7. hey everyone - couple of things that have been bothering me