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
5
votes
3 answers

Can't set video quality for media recorder.video produces flickering video

mMediaRecorder = new MediaRecorder(); // Step 1: Unlock and set camera to MediaRecorder mCamera.unlock(); mMediaRecorder.setCamera(mCamera); // Step 2: Set sources // activate this for recording with sound\ …
Jignesh Jain
  • 1,518
  • 12
  • 28
5
votes
1 answer

SurfaceView not working inside PopupWindow

I gonna show a preview using a PopupWindow based on AirView feature of Samsung SPen But the problem is that the SurfaceView is not created and non of the SurfaceHolder.Callback methods are called. The surface region becomes transparent when the…
Mohsen Afshin
  • 13,273
  • 10
  • 65
  • 90
4
votes
1 answer

Reopening camera after intent chooser is canceled

I have created a custom camera preview view CameraView which extends SurfaceView, and it also implements SurfaceHolder.Callback interface. The view operates with the camera. When you open the view it shows a camera preview. On the same screen there…
so_user
  • 43
  • 5
4
votes
1 answer

Is it possible to record video from the camera through a buffer into a file?

In particular, this is the setup I want: The built-in camera on an Android device is recording live video. This video is being saved to a buffer, which holds a few seconds of video. When the buffer is full, the oldest frames from the buffer are…
Harfatum
  • 211
  • 2
  • 5
4
votes
1 answer

How to pass SurfaceHolder via AIDL?

I have 2 separate Android app (apk). App 1 creates SurfaceView inside it and should provide AIDL methods for other apps to obtain an instance of SurfaceHolder for such SurfaceView. So the other apps will be able to draw on that view, displayed…
Andrey Suvorov
  • 511
  • 3
  • 17
4
votes
3 answers

Get RGB from a SurfaceView displaying Live camera

I am displaying a live camera in SurfaceView using camera.startPreview();. Any idea on how I can get live RGB readings from the camera? Thanks
KingsInnerSoul
  • 1,373
  • 4
  • 20
  • 49
4
votes
1 answer

Understanding SurfaceHolder concept

I want to write a program that a ball move on screen, because of this, i read many tutorial and i cant understand this line: mHolder = getHolder(); mHolder.addCallback(this); what is "this" parameter in addCallback method? why i use this method? i…
Nice NICE
  • 111
  • 1
  • 3
  • 8
4
votes
0 answers

android SurfaceHolder.lockCanvas returns null

I have been trying to do a Draw in an Observer callback and I always get a null return when I try to lock the canvas. The SurfaceHolder seems OK. I added a SurfaceHolder callback and it gets called early in the game. Here is my Observer update…
3
votes
1 answer

Change Interpolation method in scaled SurfaceView

It is possible to render a view at a low resolution, and then scale it up to fit the actual size of your view using the setFixedSize() method of a SurfaceHolder. However, the scaling is done with some kind of interpolation, causing everything to…
Jave
  • 31,598
  • 14
  • 77
  • 90
3
votes
1 answer

Getting a running android.media.MediaPlayer to persist across activities in an Application

I'm trying to show a video stream that starts in one activity of my application and follows the user to other activities in the application without having to re-prepare it. A bit of a pause on activity change is OK, but it shouldn't restart. …
Matt Tsōnto
  • 1,518
  • 1
  • 15
  • 30
3
votes
2 answers

SurfaceHolder.lockCanvas() takes too long for my game app

I'm developing an android game and I'm using SurfaceView. I have a method that will be called every 16ms (I want to have 60fps) public void myDraw(SurfaceHolder holder) { Canvas c = null; long start = System.currentMillis(); try { …
racumin
  • 69
  • 1
  • 7
3
votes
2 answers

lockCanvas failing when screen orientation changes

I'm trying to build a live wallpaper in Android, but it crashes the app when the orientation changes. It looks like it's crashing when trying to lockCanvas on the surface holder, but I'm not sure what I can do to prevent it. Here's the class: public…
Green Cell
  • 4,677
  • 2
  • 18
  • 49
3
votes
1 answer

What is the use of calling SurfaceHolder.setFixedSize()?

I have similar code to many examples floating around the net: mSurfaceHolder = mVideoSurface.getHolder(); mSurfaceHolder.addCallback(this); mSurfaceHolder.setFormat(PixelFormat.TRANSPARENT); mSurfaceHolder.setFixedSize(20, 10); Then in the…
Grzegorz Adam Hankiewicz
  • 7,349
  • 1
  • 36
  • 78
3
votes
0 answers

Android: What is the default color bitmap of SurfaceView and how to change it?

In my application I have a Translucent Activity with android:windowIsTranslucent is set to true. Activity contains a FrameLayout to which I programmatically add SurfaceView. By default SurfaceView is drawing bitmap, as per the Activity background…
3
votes
1 answer

Android - Surface is not valid

I'm trying to draw a red circle every 5 seconds. I have a draw and a run method, and the run method calls the draw method which draws the circles. However, when the draw method is called from the run method, the surface is not valid so I can't draw…
Sygnerical
  • 231
  • 1
  • 3
  • 12
1
2
3
11 12