Question about Button and SurfaceView

by Karthik Ravi Shankar » Fri, 23 Apr 2010 16:23:56 GMT


Sponsored Links
 Hi,

I am trying to use SurfaceView for an app. But I need to add buttons the
canvas as well. Not able to gather much from Android.developer site. Can
anybody post if they have done it or have some ideas ?

Thanks,
Karthik R
Graduate Student
Computer Science Department
UCLA

--



Question about Button and SurfaceView

by Mark Murphy » Fri, 23 Apr 2010 19:33:21 GMT


 


Step #1: Define a RelativeLayout.

Step #2: Put the SurfaceView as a child of the RelativeLayout.

Step #3: Put the Button as a *later* child of the RelativeLayout.

This will cause the Button to appear to "float" on the SurfaceView. See
this project for an example:

 http://github.com/commonsguy/vidtry 

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Android App Developer Books:  http://commonsware.com/books 

--


Sponsored Links


Other Threads

1. Thread crash if activity is restarted

Good day,

I am writing a program that uses a UDP poort to listen to information
send from a system. First the users sees an activity that allows them
to close the activity or start it on a port they can select (edittext)

The port is checked and if correct a new activity is launched. This
display a view items with the received information and a return
button. When started the it also launches a thread for the UDP
connection. In this thread there is a while loop that runs on a
boolean value in the activity.

The problems occurs when the user returns from the information screen
to the login and logs in again.
When they exit the information screens the following commands are
called:

active = false; //a while loop in the the thread
ServerThread.serverInitialised = false; //a while loop in the thread
InlogScherm.restart = false; //a value indicating if the users exits
the program or it only lost focus
finish(); // closes the current activity?

When logged in again the activity crashes directly. After that you can
log in, exit login, crash, login, exit, etc
by adding the command thread.close the activity closes with an error
screen (deprecated command). But a new login doesn't gives any errors
so my guess is that the error is in the fact that the thread isn't
closed.

I can't find any way to close or destroy the thread and let it stop by
stopping the while loop doesn't solves the crashes.

Does anyone have an idea on how to solve this problem?
(The code for the thread is in a different file)

-- 

2. Connection with eclipse ganymade

I am new with android and I want to configure eclipse with android and
it is giving me error related to platform.Platform not found.How to
download the platform and install it.I have downloaded the sdk tools.

-- 

3. narrowing intent filters for PACKAGE_ADDED PACKAGE_REMOVED

4. Money Laundering and Education Re-Investment in U.S. Universities

5. while i mute the sound of moto droid start my game app and start the sound in app it get crashed

6. Sipdroid application get closed after disconnecting the call

7. requestLocationUpdates / non-UI-thread / getMainLooper()