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

Surface View draws only in breakpoint debugging

I want to control drawing on Surface View from MainActivity. (user) Github link of the project is given at the end of the post. MainActivity calls draw(Drawing) method on SurfaceView instance. I have following code, the surface view only draws…
Talha
  • 903
  • 8
  • 31
2
votes
1 answer

SurfaceView destroying Surface after a while of running

I'm trying to create a surfaceView that runs a gameloop thread, I've spent forever trying to solve this issue that I get after a little while of running, the game loop seems fine it continues to run and continues to throw the error after the first…
2
votes
0 answers

Camera Intent auto crop like card IO? or Show a surface(dotted Line) and auto crop After Capture

I am using Camera Intent to capture and Upload..For Default camera So here I followed this to crop image just like card IO.. But the above one is separate camera its not Intent I want surface holder should be placed inside the camera intent .. is it…
Don't Be negative
  • 1,215
  • 3
  • 19
  • 46
2
votes
0 answers

How does Android determine screen resolution?

I've got an android-device that allows a user to change the screen resolution. For instance, I have a 1080 display and I set its resolution to 720. I can verify that the resolution changed in the TV settings. However, it seems that Android doesn't…
serg66
  • 1,148
  • 1
  • 17
  • 31
2
votes
1 answer

How to solve SurfaceHolder.setType deprecated ? Is there any other method?

What is used in place of surfaceholder.settype ? PreviewHolder = CameraPreview.getHolder(); PreviewHolder.addCallback(this); if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) …
Ashik.Aust
  • 43
  • 2
  • 5
2
votes
1 answer

java.lang.IllegalArgumentException:at android.view.Surface.unlockCanvasAndPost(Native Method)

I've searched about this problem for two days. I know that this is caused by some silly mistake but i'm unable to find that thing. It would be great, if someone helps me. Here is snippet private void draw() { final SurfaceHolder holder =…
Paresh P.
  • 6,677
  • 1
  • 14
  • 26
2
votes
0 answers

How can I play a video on a surface again after drawing black on it?

I have a video player that gets reset and loaded with a new video in one activity. One of the problems I had with this approach was that the last frame of the previous window was still shown when the next video is loaded. Several people have the…
slhck
  • 36,575
  • 28
  • 148
  • 201
2
votes
2 answers

IllegalStateException when returning to Activity containing MediaPlayer

I have an Activity with a MediaPlayer and whenever I launch another Activity from it (for example Chromecast Controller Activity or using a ShareActionProvider) and return to the Activity with the MediaPlayer, I get the following…
2
votes
2 answers

Android custom camera app retake often crashes

I am developing my own custom camera app,while running the application if I click the capture button my camera will capture the current position.what I actually need is retaking a photo whenever I need.But if I click the retake(take photo) button…
Manoj
  • 3,947
  • 9
  • 46
  • 84
2
votes
1 answer

Android/Glass: How to trigger surfaceDestroyed

Hey everyone I am fairly new to the android/glass development so please correct me if I am wrong. I tried to create a High Frequency Live Card which is fine. However when I close the app, the function surfaceDestroyed() did not get trigger and…
2
votes
1 answer

Getting image data continuously from camera, SurfaceView or SurfaceHolder

So I have this camera preview set up with Camera, SurfaceView and SurfaceHolder. I have also an ImageView where I will be putting a modified version of the camera image and I want this to update lets say once every second. All code is ready and…
Eddie Cheng
  • 171
  • 2
  • 9
2
votes
2 answers

Samsung Galaxy S4 Streaming Video Playback Orientation Issue

When playing back videos on the Samsung Galaxy S4 the video does not recognize the orientation metadata. It always plays on landscape. The app also records the video and plays correctly on all other devices while streaming. The S4 plays it fine…
2
votes
0 answers

TAG_ORIENTATION always 0 when capturing image - Android Surfaceholder

I'm trying to capture an image with Surfaceholder in Android and want to support both landscape and portrait photos. Have tried countless solutions now some of which worked on HTC devices but not on Samsung devices. So now I'm going for the…
PaperThick
  • 2,749
  • 4
  • 24
  • 42
2
votes
0 answers

Captured image gets distorted when saved - Android Surfaceholder HTC Desire S

I'm using the Surfaceholder and the camera to capture an image but when I do it on my HTC Desire S the captured image looks like this. This is not what it looks like in the preview-view. It works on two of the other phones I have been testing on…
PaperThick
  • 2,749
  • 4
  • 24
  • 42
2
votes
1 answer

SurfaceHolder.lockCanvas() returns null

I'm trying to create a canvas and draw a bitmap to it using the following code: Paint paint = new Paint(); InputStream is = assets.open("card_art" + File.separator + "texture.png"); Bitmap bitmap =…
bionicOnion
  • 1,494
  • 3
  • 16
  • 25