Questions tagged [surfaceholder]

Abstract interface to someone holding a display surface. Allows you to control the surface size and format, edit the pixels in the surface, and monitor changes to the surface. This interface is typically available through the SurfaceView class.

Abstract interface to someone holding a display surface.
Allows you to control the surface size and format, edit the pixels in the surface, and monitor changes to the surface.
This interface is typically available through the SurfaceView class.

When using this interface from a thread other than the one running its SurfaceView, you will want to carefully read the methods lockCanvas() and Callback.surfaceCreated().

Reference page: http://developer.android.com/reference/android/view/SurfaceHolder.html

175 questions
2
votes
0 answers

How to build a custom camera recorder app?

I am trying to develop a custom camera video recorder. When my devices execute the start MediaRecorder method in beginRecording() in the Activity, the app crashes. I don't know what is wrong, because I follow the Google API Guide. My devices use…
beni
  • 3,019
  • 5
  • 35
  • 55
2
votes
1 answer

Occasional Stutter/Lag in game loop from lockCanvas method

I am smooth scrolling a bitmap at a given speed. I'm doing this with a game loop. It scrolls pretty smoothly, around 60 fps, except for occasional stutters / jumps. These jumps occur anywhere from once a second to a couple of times a second. …
1
vote
0 answers

Error in android tetris - getEntry

At the time me and a friend are programming the classic game Tetris, for a school project. I have been programming for an while now and had implemented both a rotate and a moveBlock, and newBlock, draw, etc., methods, so I thought now maybe would be…
1
vote
1 answer

Android - SurfaceView. Updating WITHOUT clearing the screen. (Note: I'm a Noob)

I've been running into a weird problem trying to use SurfaceView. Like this one, It works, but it keeps flickering between 2 frames*. Also, unlockCanvasAndPost Takes around 30-50Ms, Is this normal? Redrawing everything each time is NOT a good idea…
Anon
  • 11
  • 2
1
vote
1 answer

Canvas stop recognizing trace Android

Trying to make a canvas that works using MotionEvent.ACTION_MOVE. However after the thread is started horizontal lines draw correctly, but none of the other lines work or are sporadic. As soon as I release the event, the lines clear…
RyanInBinary
  • 1,533
  • 3
  • 19
  • 47
1
vote
0 answers

Understanding of SurfaceView with and without SurfaceHolder.Callback

I'm experimenting with SurfaceView and creating simple animations with it, I don't understand why my animation (changins screen color from black to white) is working here (without using SurfaceHolder.Callback) public class MySurface extends…
leedwon
  • 142
  • 1
  • 9
1
vote
1 answer

Two SurfaceHolders in one Activity

I want to play one RTSP stream in a surfaceView while I prepare the other in a separate thread. However, the MediaPlayer does give an error when instantiating two SurfaceHolders: Command PLAYER_PREPARE completed with an error or info…
dulys
  • 77
  • 1
  • 9
1
vote
0 answers

Android Surfaceview SurfaceHolder Thread

En: I use surfaceview mapping (ecg) because need different speed of two ecg,so I created two custom extends surfaceview class open thread in the surfaceCreated ,thread to the rest of the mechanism to realize how long time, Question: when there is…
1
vote
1 answer

Camera not being released properly on Astro Tab A10 running Marshmallow

I have the some of the following code to use the camera: @Override public void surfaceCreated(SurfaceHolder holder) { if (mCamera == null) { mCamera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK); try { …
Pink Jazz
  • 784
  • 4
  • 13
  • 34
1
vote
0 answers

Getting an android app to keep it's OpenGL Context after hitting the home button

First a bit of context: I'm developing a video game for both the Android and iPhone platforms. The way the iPhone works, when a user hits the home button and returns to the game later, in most circumstances the game will pick up RIGHT where it left…
1
vote
1 answer

How to play live streaming in RecyclerView using libVLC?

I am developing app to monitor IP camera using my mobile. Below is my MainActivity. I am using libVLC which uses surfaceview to show the video. public class MainActivity extends…
Bakyaraj
  • 21
  • 6
1
vote
1 answer

SurfaceView Camera App Switch Camera and Fix Dark Preview

I am building a camera app using surface view. The app loads the camera properly and image is captured. There are two scenarios in image capture: The image is captured and nothing i.e bytes array is sent to the preview activity. It works fine…
user9358862
1
vote
1 answer

holder.getSurface().isValid() is returning false

I am using Surfaceview to change the background image. But I am getting false on holder.getSurface().isValid() and I don't know why. I looked at some of the similar questions here, but still could not solve it. Is there something missing on what I…
Gkush
  • 45
  • 8
1
vote
0 answers

Android SurfaceView draws bitmap multiple times

I'm trying to draw a bitmap into surfaceView I can successfully draw but I need to move that bitmap around the screen based on some other user movements but when I set canvas.drawColor(Color.TRANSPARENT); canvas.drawBitmap(bitmap, left, top,…
G.L
  • 139
  • 1
  • 4
  • 16
1
vote
0 answers

Android - Implement security in WallpaperService

I am using the WallpaperService class to set a live wallpaper on the device. I want to implement security on the system screen (to prevent screenshot or recording) where the 'Set Wallpaper' button shows up by the android system. So far, I have found…