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
34
votes
1 answer

SurfaceHolder.setType is deprecated... But required?

void android.view.SurfaceHolder.setType(int type) public abstract void setType (int type) Since: API Level 1 This method is deprecated. this is ignored, this value is set automatically when needed. Sets the surface's…
bwoogie
  • 4,339
  • 12
  • 39
  • 72
27
votes
1 answer

java.io.IOException: setDataSource failed.: status=0x80000000

I am trying to play url using media player in activity using: mediaPlayer = MediaPlayer.create(getApplicationContext(), Uri.parse("http://www.pocketjourney.com/downloads/pj/video/famous.3gp"), holder); It's working fine. Same code I use to set it…
CoDe
  • 11,056
  • 14
  • 90
  • 197
26
votes
7 answers

Android Camera will not work. startPreview fails

I'm getting these errors from LogCat: 10-30 00:31:51.494: D/CameraHal(1205): CameraHal setOverlay/1/00000000/00000000 10-30 00:31:51.494: E/CameraHal(1205): Trying to set overlay, but overlay is null!, line:3472 10-30 00:31:51.494:…
Matthew Mitchell
  • 5,293
  • 14
  • 70
  • 122
18
votes
2 answers

How to show the camera preview on a SurfaceView?

I am trying to open the camera hardware on a SurfaceView. In the layout, I created a SurfaceView and I open the camera as shown in the code below. When I run the code, the toast in the CameraAvailableCB shows up and says "onCameraAvailable" but…
Amrmsmb
  • 1
  • 27
  • 104
  • 226
13
votes
3 answers

How to attach MediaPlayer with SurfaceView in android?

I'm building video player with android media player object. i'm able to hear the audio but the video does not appear on surfaceView. here is my code public class PlayerActivity extends Activity implements SurfaceHolder.Callback { String…
Sujith S Manjavana
  • 1,417
  • 6
  • 33
  • 60
12
votes
3 answers

Android Camera - app passed NULL surface

Whenever I run the cam_thread I get the error "app passed NULL surface". This code supposedly works on the HTC Incredible 1. I've reconfigured it slightly to run on a droid x. However I still get this error. public class Android_Activity extends…
EDPittore
  • 135
  • 1
  • 1
  • 6
11
votes
1 answer

Wallpaper crashes with error - queueBuffer: error queuing buffer to SurfaceTexture

Live Wallpaper crashes, code below public void render(){ Canvas canvas = null; try{ canvas = this._surfaceHolder.lockCanvas(null); synchronized (this._surfaceHolder) { this.onDraw(canvas); } …
Rajesh
  • 380
  • 5
  • 13
10
votes
2 answers

"The surface has been released" inside "surfaceCreated"

I know this is a common question, however this stack trace shows something else is wrong. You can see that even though setDisplay(holder) is called inside of surfaceCreated it still throws IllegalArgumentException. This isn't a rare exception…
bclymer
  • 6,679
  • 2
  • 27
  • 36
7
votes
2 answers

Setting background colour for a SurfaceView in Android

I am building a paint application for android. Extending the FingerPaint application sample provided with the SDK. However, unlike FingerPaint, I'm using SurfaceView with a separate rendering thread to draw to the surface. All this is very standard…
sanjeev mk
  • 4,276
  • 6
  • 44
  • 69
7
votes
1 answer

Cam picture on surface holder, draw: Exception because of surface type

I'm using a SurfaceView with a SurfaceHolder to start off with a camera preview in my test app. public class TextLocatorActivity extends Activity { private Preview pvw; @Override public void onCreate(Bundle savedInstanceState) { …
rdoubleui
  • 3,554
  • 4
  • 30
  • 51
7
votes
2 answers

SurfaceView Example

So I've spent about two days trying to get a working SurfaceView. Tutorials I am following online aren't working even when followed to the letter. I normally get an entirely black screen. In order to help teach myself how it works I need a working…
Frenchie
  • 151
  • 1
  • 1
  • 9
7
votes
1 answer

Android Camera: app passed NULL surface

I've found several questions on this but no answers so here's hoping someone might have some insight. When I try to swap the camera I call the swapCamera function below. However the camera preview just freezes (the app is not frozen though just the…
Aggressor
  • 13,323
  • 24
  • 103
  • 182
6
votes
2 answers

SurfaceHolder.lockCanvas() Returning null

I'm making a game, and since I'm new to Android, I based the design off of the example LunarLander code. In its design, GameThread.doStart() is called from GameActivity, and the thread then runs everything from its GameThread.run() loop as shown…
Jesse Jashinsky
  • 10,313
  • 6
  • 38
  • 63
6
votes
1 answer

LiveWallpaper with SurfaceHolder.lockCanvas(Rect dirty)

I would like to ask about a problem that has been addressed here once or twice, but none of information I found could help me overcome the problem I faced a few days ago. I want to make a live wallpaper for android using canvases - it is not…
petrelli
  • 61
  • 1
  • 3
5
votes
1 answer

Attempt to invoke virtual method 'android.view.SurfaceHolder android.view.SurfaceView.getHolder()' on a null object reference

i'll be simply generate video recorder application using Camera. but it's crash and give me a bellow error : Attempt to invoke virtual method 'android.view.SurfaceHolderandroid.view.SurfaceView.getHolder()' on a null object…
1
2 3
11 12