surfaceview

Overlay images onto Camera preview SurfaceView

I have a SurfaceView that is being used to draw images, and I would like to overlay them onto a live-feed from the phone's camera. Currently, the SurfaceView that contains the images have a white-background, but if I were to overlay them onto the phone's camera feed, they would have to be transparent. The camera and animation drawing ca...

SurfaceView flickering/tearing

Hi Everyone, I'm trying to figure out how to work around my problem. I've read http://groups.google.com/group/android-developers/browse_thread/thread/a2aac88a08cb56c2/b7dff4ba388cd664?lnk=gst&q=SurfaceView#b7dff4ba388cd664 which sort of answers my question but as far as I can tell, it's a sort of "tough luck" answer. So here's my pr...

onActivityResult fc when using SurfaceView on Android

My app fc when activity that's using SurfaceView as content view calls startActivityForResult(...) and activity that has been started calls finish() This does not happen if I change content view to something else than SurfaceView. This would be the requested logcat: 09-05 00:17:18.926: ERROR/AndroidRuntime(339): Uncaught handler: thre...

How can I sense if the user is holding down their finger on the screen without moving it?

I am currently using pure OpenGL to paint buttons in my own little way. I can detect if a button is pushed with onTouchEvent, but I want to know if the user is holding the button down, or if the user is no longer touching the screen. ...

Layout with dynamic position

Hi, I have a layout which might be a bit unusual. The structure is the following: <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <org.CustomSurfaceView android:id="@+id/page_flip"...

SurfaceView KeyEvents

I'm making great progress porting my Color Computer Emulator to Android. It works on a Droid 2 with a hardware keyboard but I'm unable to get the virtual keyboard to send KeyEvents to my SurfaceView subclass. I've included the setFocusable(true), setFocusableInTouchMode(true), requestFocus() and requestFocusFromTouch() in the View per su...

Android: Error inflating class

Hello, I'm new to Android development and I've been having an issue that I haven't been able to fix. I'm mostly using code from examples provided in the SDK so I'm not sure what's happening here. I'm simply trying to create a custom view GhostSurfaceCameraView that extends SurfaceView. Here's my class definition file GhostSurfaceCameraVi...

How to program a scrolling game camera in android?

Hello, I am currently trying to write a simple shoot them up game with top down perspective. I am using SurfaceView and Canvas to draw the graphics on the screen, but I cannot find out how to make the "camera" scrollable. The player character is always in the center of the screen and the camera(SurfaceView's canvas essentially) is suppo...

How to pass a keyEvent object to a Button to let it appears like clicked?

Hello,i have made a surfaceView to accept a OnTouchEvent,and in this view, i draw a Button manually with Button.draw(Canvas)(not make a ViewGroup). now, this button can be drawn on my SurfaceView, but when i pass a keyEvent from OnTouchEvent to Button like Button.onTouchEvent(keyEvent), but this button cannot show the click effect so t...

SurfaceView to Bitmap

I am trying to convert my SurfaceView (camera preview) into a Bitmap for face detection on the fly. I am receiving a not null image but when I display it onto a view it appears to be plain black. Any ideas what might be the reason and how to proceed? (I believe it is difficult but not impossible to extract the bitmap from a SurfaceView ...

How do I rotate a canvas without disturbing the coordinate system in Android?

I am trying to rotate a canvas with canvas.rotate and move an object on it at the same time. The problem is that with the rotation, the coordinate system of the canvas rotates as well, so I get cases when my object is supposed to be moving along the y axis, but the y axis is rotated on place of the x axis. It is a mess. Is there a way to...

Button does not display in surface view

How do I create a button in the surface view? I added a button in surface view but it is not displayed. Please suggest a solution. ...

Android SurfaceHolder.unlockCanvasAndPost() does not cause redraw

I'm implementing a fairly standard app with the Android sdk that involves drawing using the SurfaceView, SurfaceHolder, Callback setup. In my main thread (UI thread) I have no drawing or handling of the SurfaceHolder (or the canvas you retrieve with it). In a separate thread I have the following: Log.i("GAME.DrawThread", "run()"); ...

Weird layout problem. (please see the attached image)

The image above is the first page of my game. Normally the big blue 'button' background image should not show up there. I declare my custom background image for my buttons in layout file like this: <Button android:id="@+id/id_button_startgame" android:layout_width="wrap_content" ...

AndEngine & SurfaceView (CameraPreview)

How do you add a SurfaceView showing the camera preview as the background of the BaseGameActivity of AndEngine (Physics Example). @Override public Scene onLoadScene() { mBackgroundView = new PreviewView(this); addContentView(mBackgroundView, new LayoutParams( Layout...

Returning to SurfaceView after another Acitivity has taken focus

I'm working on an RPG for Android, using the LunarLander API demo. I've already made a game using this demo (Porcupine Assassin, check it out!) so I've got a good grasp of the Canvas class and things of that nature. My problem is, in RPGs you need a way to access inventory, stats, etc. So I've set the BACK button to start the class Inve...

Compositing Android MapView and SurfaceView

I have an application with a SurfaceView and a MapView. They are displayed in a single view, like so: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainlayout" android:layout_width="fill_parent" android:layout_height="fill_parent" > <co...

android surfaceview can't work

it's a easy question, but I can't figure it out: this is my xml : <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android = "http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <GG.My_pic.testA android:id = "@+id/myview" android:layo...

The efficiency about android canvas drawing

Hi, I've been wondering if canvas has a limit boundary. I mean if I use functions such asdrawline(), drawbitmap(), drawcircle(), does android really draw something on the canvas and waste some CPU cycles?? because after all the drawing functions, the actual picture print on the screen is decided by the screen size. And if I draw on som...

The advantage of onTouchEvent V.S. onScroll

I want to perform a smooth movement of a picture when user scroll it. So which one is better if my FPS is >60 ?? ...