Android Camera on a tab

All your problems with Audio, Video and Images.

Android Camera on a tab

Postby chrispix » Fri Dec 12, 2008 4:48 am

I am trying to do a TabHost and have the camera preview, and some buttons for taking picture etc on the tab. I think I can do the overlays, I just can't for the life of me figure out how to get the preview assigned to surface (I think that is what I need to do) There is so much information that is pre 1.0 I have confused myself and probably making this much harder than necessary.. here are some code snippits.
If I am way way off, please offer some assistance if you don't mind.. Thanks!
---------------------------------- JAVA -----------------------------------
public void onCreate(Bundle icicle)
{

super.onCreate(icicle);
setContentView(R.layout.park);

//TabHost host=getTabHost();
TabHost tabs=(TabHost)findViewById(R.id.tabhost);

tabs.setup();

TabHost.TabSpec spec=tabs.newTabSpec("tag1");


spec.setContent(R.id.tab1); // USE .XML for LAYOUT.
spec.setIndicator("Clock"); // NAME ON TAB
tabs.addTab(spec); // CREATE TAB



spec.setContent(R.id.LinearLayout01);
spec.setIndicator("Clock2");
tabs.addTab(spec);


SurfaceView surfaceView = (SurfaceView)findViewById(R.id.SurfaceView01);
mHolder = surfaceView.getHolder();
mHolder.addCallback((Callback) this);
camera.setPreviewDisplay(mHolder);
//mPreview = new Preview(this);

//setContentView(mPreview);
camera.startPreview();

------------------------------------- LAYOUT XML -------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabHost android:id="@+id/tabhost"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="62px">
<AnalogClock android:id="@+id/tab1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerHorizontal="true"
/>
<Button android:id="@+id/tab2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="A semi-round button"
/>

<LinearLayout android:id="@+id/LinearLayout01" android:layout_width="wrap_content" android:layout_height="wrap_content">

<SurfaceView android:id="@+id/SurfaceView01" android:layout_width="wrap_content" android:layout_height="wrap_content"></SurfaceView>
</LinearLayout>

</FrameLayout>
</TabHost>
</LinearLayout>
chrispix
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Dec 12, 2008 4:42 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: Majestic-12 [Bot] and 4 guests