Main App & SurfaceHolder?

by gabehabe » Tue, 16 Dec 2008 06:28:33 GMT


Sponsored Links
 Hey guys, total Android noob here. :)

For my first app, I'm having a go at developing a simple video camera
app.
(There isn't one yet~!)

So I've been reading through the docs, and I've come up with a tiny
bit of code.

...Sorry if there's code tags. (I'm a mod over at another forum, I
know the rules!) ;)

Anyway, I digress.

package com.android.hello;

import android.app.Activity;
import android.os.Bundle;
import android.hardware.Camera;

public class HelloAndroid extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Camera cam = Camera.open();
        cam.startPreview();
    }
}

I'm stuck on assigning something with cam.setPreviewDisplay();

I've looked in the docs, and come across this method. I know it takes
a SurfaceHolder as a parameter.

But I can't instantiate a SurfaceHolder object, so I'm assuming the
main app has one?

Thanks in advance,
Danny

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



Main App & SurfaceHolder?

by Stoyan Damov » Wed, 17 Dec 2008 07:34:39 GMT


 Create a new view, subclassing SurfaceView, set this view for your
activity, and then you can call getHolder to obtain the surface
holder.
OR, read 
 http://code.google.com/intl/bg/android/reference/android/view/SurfaceView.html 
OR, read LunarLander's source code ;)

Cheers,
Stoyan




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


Sponsored Links


Other Threads

1. SlidingDrawer interaction

Hello

I'm trying to interact with the SlidingDrawer I've made, following the
Android sdk.
What should I do to  fix a Listener on the different item in the
SlidingDrawer?
thx a lot

I've tried this but throwing an exception during the execution
SlidingDrawer Slide = (SlidingDrawer) findViewById(R.id.
Slide.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
                showDialog(VITESSE_DIALOG_ID);
    }
});

-- 

2. Record voice calls on HTC Tattoo or HTC Hero

Hi.

I need to write application for HTC Tattoo or HTC Hero that can record
voice calls.
HTC Tattoo comes with Android SDK 1.6
As far as I know SDK 1.6 support this feature -
http://dev.android.com/reference/android/media/MediaRecorder.AudioSource.html
But i find this Issue -
http://code.google.com/p/android/issues/detail?id=4247&can=1&q=AudioSource&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

Questions:
1. an i write application with voice calls recording feature for HTC
Tattoo or HTC Hero?
2. Maybe i need to use another method, not
http://dev.android.com/guide/topics/media/index.html#capture ?
3. What android phones support voice calls recording feature?

Thanks.

-- 

3. Getting IM Ids from the contact database in 2.0

4. How to change application theme at runtime

5. medical charge capture

6. Is it possible to design an app with 45M of mp3 files included?

7. Cannot get MSISDN (phone number) but can get IMSI on HTC G3