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. Can two application's content providers share one authority?

Hi,

   Can i override already existing content provider
   by implementing another ContentProvider with same authorty?

   If that is the case.
   How can android system decides ContentProvider to handle data
requests?

   What is typical usae of MIME type?

   We maintain unique URI for each Data.
   Then why do we need MIME type again?

   Is not CONTENT_URI enough for all requests?

   If it is not the case.
   Can you give me some example, where MIME play it's unique role?
   Intent-filter are able provide information about URI as well as
MIME type.


   Thanks in advance.

-- 

2. Adding separators to a ListView

Hi all. I have created a ListView from a collection of objects, using
an ArrayAdaptor to set the items.

The objects used to populate the list have a NAME field, and are
sorted into alphabetical order, so ultimately the ListView is long
list of names.

I now want to make the list more user friendly. I'd like to add a
separator for each letter of the alphabet, saying "A", "B" etc. The
separator could be one of the list items (non-clickable) or just a
normal View.

I'm just not sure how I can manipulate the ListView to achieve this,
and would appreciate any help.

Thanks.

--

3. Using <Uses-Library> in android application

4. Android Contact Search

5. CLosed WTB: pulsa XL murmer

6. DONT FORGIVE - DONT FORGET - 26/11 - 2 Years But Nothing Different

7. PUBLISHED APPS MISSING FROM UPDATED CONSOLE