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


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

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

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,


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
OR, read 
OR, read LunarLander's source code ;)



Sponsored Links

Other Threads

1. SlidingDrawer interaction


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
thx a lot

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


2. Record voice calls on HTC Tattoo or HTC Hero


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 -
But i find this Issue -

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 ?
3. What android phones support voice calls recording feature?



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