p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2
This is the forum to discuss the Wrox book Professional Android Application Development by Reto Meier; ISBN: 9780470344712

Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 2nd, 2009, 09:09 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Use SurfaceView in layout

I have this book and I love it! :)

There is a place in the book (ch.11, page 390, middle of page) where it says and I quote:

"A SurfaceView can be used in exactly the same way as any View-derived class. You can apply animations and place them in your layouts as you would any other view."

But I'm not having any luck doing this with my SurfaceView.

Here is my java code:
Code:
        setContentView(R.layout.takepic);
        //setContentView(camPreview); //set preview as activity content
        camSurface = (SurfaceView) findViewById(R.id.camsurface);
Here is my layout code:
Code:
<SurfaceView android:id="@+id/camsurface"
	 android:layout_marginTop="20dip" 
	 android:layout_width="240px" 
	 android:layout_height="160px" 
	 android:layout_gravity="center_horizontal"/>
If I use the setContentView(camPreview);, my camera preview appears on the screen, but not in my layout.

If I use the camSurface = (SurfaceView) findViewById(R.id.camsurface);, my layout appears, but my camera preview does not show up in the layout, I just get a black area where it shoud be. Can anyone help please?!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Layout Managers ironchef Java Basics 1 October 20th, 2006 06:09 AM
Layout problem roy_mm Reporting Services 1 September 28th, 2006 04:43 PM
Help with form layout djjasonsa Access VBA 1 February 15th, 2005 12:50 AM
layout adflynn Java GUI 0 November 9th, 2004 06:33 AM
Table Layout benskywalker Dreamweaver (all versions) 3 October 22nd, 2003 12:48 PM



All times are GMT -4. The time now is 02:25 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc