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
1
vote
2 answers

Video Freeze after lock screen on SurfaceView using SurfaceView and MediaPlayer

I was trying to use SurfaceView and MediaPlayer to Display video on Android. I got a bug now that if I press the power button to lock the screen and then unlock it, The Video displayed on the MediaPlayer is gone and there is only sound. Normally for…
1
vote
2 answers

How to play 3 videos from raw folder in same Activity on different Button clicks in Android?

I have to play three videos on 3 different Buttons in same Activity. My first video gets played and if I play another video the last screenshot like image comes in foreground and the current video is playing behind the screenshot like image of…
1
vote
1 answer

SurfaceHolder : IllegalStateException - Surface was not locked

I am getting an error in my program. The error seems to state that my surface isn't locked when I try to unlock it at the end my draw sequence. But as shown in the code below. I do lock the the surface first thing. Why am I getting this error. What…
Randolph
  • 951
  • 2
  • 11
  • 24
1
vote
1 answer

Android Camera Preview not showing properly on google glass?

I am developing a camera app and the problem is that the camera i am making shows a distorted preview. The picture it takes is clear but the preview is messed up. Complete camera preview code is below just in case: import…
1
vote
1 answer

Turn LED on with Camera Disabled

We just got some Samsung Galaxy S4 running 4.3 at work and we are using a Mobile Management system that Disables the Camera for security reasons. I have created a FlashLight App (That works fine on my HTC one and Nexus 10) that I would like to use,…
Sobo
  • 487
  • 8
  • 21
1
vote
2 answers

Camera does not open on HTC devices

I have built a Camera based on the code example presented here and have enhanced it with the Camera.java and ShutterButton.java from AOSP GingerBread,the code I took away was mostly for the autofocus and for the ShutterButton.The Camera has been…
1
vote
2 answers

How to redraw Canvas partially?

I am a newbie. I make a simple game using Canvas. I wrote almost all the code inside the onDraw() method and there is a lot of calculations there. There is an invalidate() method in the end of onDraw() in my code. That's how I call to redraw my…
1
vote
1 answer

Android Surface Camera Preview crash after onPause/onBackPressed

Im trying to set up a custom SurfaceView (which work as excepted) for the first time. After onResume/onPause has been called im getting a "media server died" message. After the media server died i can add another preview. Any idea why it's…
Emanuel
  • 8,027
  • 2
  • 37
  • 56
1
vote
1 answer

Attach second instance of MediaPlayer to SurfaceView (Error on Android Gingerbread)

I have got an error concerning MediaPlayer in combination with a surfaceview: I am playing a video in a surfaceview by Streaming it from the Internet as follows: mPreview = (SurfaceView) findViewById(R.id.surface); videoFL = (FrameLayout)…
1
vote
0 answers

Error starting camera preview: startPreview failed

I am new to Java and android development. I am trying to open a camera in a app as shown in the android development sites. I have a CameraActivity which calls the CameraPreview. As stated in the title, I get the error "startPreview failed". That is…
user2439231
  • 15
  • 1
  • 6
1
vote
2 answers

Why is my android activity being stopped?

I have inherited some code from an application that I need to modify (yuck). The activity in question implements SurfaceHolder.Callback and SensorEventListener. This activity is for a custom Camera. The code works fine to autofocus, and take a…
Innova
  • 1,751
  • 2
  • 18
  • 26
1
vote
0 answers

Camera View is getting displayed in surface holder

I am trying to display camera view in the surface holder. It displays a black screen with no camera view. I added all permissions in Manifest file. This is my code, public class MainActivity extends FragmentActivity implements LocationListener, …
Mahe
  • 2,707
  • 13
  • 50
  • 69
1
vote
2 answers

Android Surface class Surface.ROTATION_ cannot be resolved or is not a field

I'm trying to fix my camera app. When i hold the camera in landscape mode, it previews on the screen sideways. I found this fix on stack : Android - Camera preview is sideways In my CameraSurfaceView class constructor, I get the surface like this…
Naterade
  • 2,635
  • 8
  • 34
  • 54
1
vote
1 answer

getSurfaceHolder().getSurfaceFrame() reurning Rectangle with zero height and width

I am working on a basic live wallpaper. The code is working fine on my "Galaxy S2(GT-I9100) running ICS" and the function is returning correct height and width value. But when I tried to run the same apk on different device "Galaxy S2(SHW-M250L)…
1
vote
0 answers

Thread is to be running if surfaceDestroyed() is called when home button is pressed

I am new to android Surfaceview implementation. I am developing RDP client application in android3.0. I getting the image stream from socket, drawing this image to surface using Surfaceview and Thread. The sample code of surface view: class…
mini
  • 855
  • 4
  • 15
  • 22