surfaceview

Android: Regaining focus using SurfaceView

I'm currently getting to grips with Android, playing around with the Lunar Lander sample. I've found that if you navigate away from the app (eg, hit the call button) it will destroy the underlying surface (calling surfaceDestroyed). Navigating back (which will trigger onWindowVisibilityChanged) the app will crash, as it will try to dra...

Processing events in SurfaceView

Hi, I am creating a custom Widget which extends SurfaceView and I am planning to use it for camera preview. In the main activity I tried to implement some event listeners but can't catch any event. This is the part of code where I tried to add an event listener: videoPreview = (CaptureView)findViewById(R.id.capturePreview); vide...

Android SurfaceView scrolling

I'm writing an android application that builds an offscreen bitmap that is (say) 640*480 pixels and displays that in a SurfaceView. Note that the size of the image is larger than the actual display on the handset. The way that the application works is that it initially displays the upper left corner (0,0) of the image and then I would ...

Is OpenGL on Android a battery killer?

Hey, I'm currently implementing a software keyboard ( using some sophisticated prediction ), and drawing it using canvas is insufficient in terms of perfomance. I'm getting frame drawing times well above 100ms, which is clearly unacceptable. The keyboard itself consists of about 33 keys, each of them drawn using drawRoundRect and a sim...

Android - ClipDrawable, ScaleDrawable, how does it work?

I'm having quite a problem here and I hope for someone here to able to help me. let's go. Let's say, I have quite a big image ( 1500x2000 ), i load it as a drawable, fine so far. Now I have a SurfaceView and I want to draw a certain region ( lets say the top-left-most region ) onto a canvas, in a non-scaled version. I thought using Cli...

Fireing Android Dialogs from another thread without Message Loop

In a SurfaceView, I'm dispatching new thread that draws on canvas within standard "LockCanvas-Draw-unlockCanvasAndPost" loop. (note that thread doesn't contains message loop). How to show Android standard Dialog from that thread? As thread doesn't have msg loop, following code doesn't work: Builder builder = new AlertDialog.Builder(th...

surfaceview + glsurfaceview + framelayout

Hi, I'm new at this (java and opengl) so please bear with me if the answer to the question is simple. :) I'm trying to get a camera preview screen with the ability to display 3d objects simultaneously. Having gone through the samples at the api demos, I thought combining the code for the the examples at the api demo would suffic...

android video, hear sound but no video

I have tried several different examples but I cannot get any video to show. I hear sound but no video. I thought maybe I just had a incorrect video format so I downloaded a fiat commercial in 3gp format and still no joy. I am using the eclipse JEE with android sdk and my app targets the 1.5 sdk (Api Level 3) without google api. Could som...

I am having trouble with every Android graphics/SurfaceView tutorial.

Hello, I'm trying to learn how to make video games on Android, and therefore I'm needing to get some decent tutorials going on how to make graphics on Anroid using the SurfaceView object. However every single graphics tutorial I've tried (mainly SurfaceView stuff) has failed. Please note that I don't want to use XML, as it is out of my...

Should I use OpenGL for chess with animations?

At the moment I am experimenting with SurfaceView for my chess game with animations. I am getting only about 8 FPS in the emulator. I draw a chess board and 32 chess pieces and rotate everything (to see how smooth it is), I am using antialiasing. On the Droid I'm getting about 20FPS, so it's not very smooth. Is it possible to implement a...

android surfaceview is no longer visible after back from other activity

i have a question in developing some android program... i use surfaceview for camera preview. it works fine, but has one problem when i start other activity (by clicking something) and then back from that activity. after that, surfaceview is no longer visible. (but onclicklistener is working) but when i occur surfacecreated/destoryed b...

Android game goes blank after pressing home and restarting

I am making an Android game with an Activity called Game, a SurfaceView called GameView and a Thread called GameThread. The Game's onCreate(), I make a new GameView, which makes a new GameThread, where all the game logic and canvas drawing is carried out. However, I'm having some lifecycle difficulties. When I press back and restart it,...

How to make a SurfaceView always horizontal?

Hello there... I'm using SurfaceView to draw some stuff using canvas. The problem is that I want to show everything horizontally by default and keep it that way regardless the position of the device. I'm not using any layout XML file to show the SurfaceView; instead I just have a class that extends SurfaceView and I do setContentView(ne...

Android: Frame rate drops in landscape mode

I am trying out the (latest) Android SDK, and noticed some strange behavior. I've written a skeletal SurfaceView app: Activity, SurfaceView and a rendering thread. It doesn't actually do any painting, and only writes out the framerate to logcat once a second. When it runs in portrait mode, I get around 60 fps. However, when I flip it to...

How to draw an overlay on a SurfaceView used by Camera on Android?

I have a simple program that draws the preview of the Camera into a SurfaceView. What I'm trying to do is using the onPreviewFrame method, which is invoked each time a new frame is drawn into the SurfaceView, in order to execute the invalidate method which is supposed to invoke the onDraw method. In fact, the onDraw method is being invok...

Android's EditText is hidden when the virtual keyboard is shown and a SurfaceView is involved

I have a simple user interface: an EditText should be located below a SurfaceView. I use a RelativeLayout to arrange these two views. Now, when I tap on the EditText to open the virtual keyboard the SurfaceView slides up but the EditText is hidden and does not show the typed string. To reproduce, use the following layout XML code: <?...

Adding View extending from SurfaceView to layout gives me a blank screen

I'm very new to Android programming, so this is probably something pretty basic. I just have an xml layout with a few buttons. I'm trying to follow the model given by the JetBoy demo, so I'm adding a view to the layout which extends SurfaceView. When this new view is put in my xml layout, I just get a blank screen. Here's the XML l...

help laying out views on a surfaceview

* Introduction* I need to develop an augmented reality mobile application for my HCI class...it basically has to recognize a visual tag and visualize a virtual notice board. I used, as starting point, some code from zxing android test application (http://code.google.com/p/zxing/) which has all the necessary code for taking a photo and a...

Draw a transparent image on surface view

My objective is to run a glowing animation on an image.I am changing the image alpha to produce this effect. I have used basic AlphaAnimation provided in android framework but found that its slowing down other animations. So i extended a class from SurfaceView and created a thread to update it. ( Again here, i am manipulating alpha of t...

Obtaining SurfaceView dimensions...

Hi everyone ! I think I might be about to ask a dummy question, but I'm still new with Android programming, and I couldn't (despite all my efforts) find my answer on Google. The thing is, I'm trying to develop a little game, with 2D Graphics. I want my "gaming board" to be at a specific position on my screen, so that I can display in-g...