surfaceview

Why is a SurfaceView in a Fragment still visible when the Fragment is hidden?

允我心安 提交于 2019-12-06 14:28:55
Just a general question: I have a Fragment which has a SurfaceView. When I hide the Fragment by the FragmentManager, the SurfaceView is still visible. I found a workaround by just setting the View to INVISIBLE/GONE/VISIBLE when the Fragment is hidden/visible - but I'm wondering: Why is the SurfaceView still shown? Is it because the SurfaceView basically is a "punched hole", which means, it's not in the Layout-Hierarchy of the Fragment and therefore can't be hidden when the Layout is hidden? What is the hiding-procedure doing with the Fragment? Does it simply sets the created view to gone? A

How to show SurfaceView on Lock Screen?

你离开我真会死。 提交于 2019-12-06 12:47:32
问题 I'm working to implement a lock screen just like the water ripple lock screen of Samsung Galaxy 3. I have finished the GLSurfaceView object. But there is a problem when I port it to Lock Screen. The SurfaceView couldn't be displayed on Lock Screen whose window type is TYPE_KEYGUARD. If I use setZOrderOnTop(true) to this SurfaceView, it Can be displayed, but it will overlay all other layers of Lock Screen, which is not my anticipation. This SurfaceView can display normally on normal

android: Difference between pressing home button and power button?

倖福魔咒の 提交于 2019-12-06 12:27:24
does anybody know the difference between pressing the power button and the home button? In my app, I've tried putting a debugging statement in every lifecycle of the activity and both result the same, that is, the activity will be onPause and will be onRestart then onResume when the activity is re-opened (if we press home button earlier) or when we turn on the device again by pressing the power button (if we press power button earlier). Having this same behaviour/sequence, I expected my camera app to run the same in both cases. But it's not. I used surfaceview to preview to camera. If the

How to fix memory leak in SurfaceView

北慕城南 提交于 2019-12-06 12:14:41
问题 I met a memory leak issue in surfaceview. I define a custom view MyView which extends from surfaceview. int Layout file <com.andoird.example.MyView .... .... /> and setContentView in onCreate(); after finish the Activity. I get the log below; It show the there are memory leak in Surface view. I hope someone can help me to resolve this. Thank you! use Android 4.2. Log 1: 08-16 16:29:23.751 E/StrictMode(23220): A resource was acquired at attached stack trace but never released. See java.io

app passed NULL surface, while taking a picture without a surfaceview

心已入冬 提交于 2019-12-06 11:57:00
I'm writing an android app. I encounter the following problem: app passed NULL surface while executing the following code: public void takePictureNoPreview(Context context){ try { myCamera = Camera.open(0); } catch (Exception e) { e.printStackTrace(); console.append("Failed to connect to camera\n"); } if(myCamera!=null){ SurfaceView dummy=new SurfaceView(context); try { myCamera.setPreviewDisplay(dummy.getHolder()); myCamera.startPreview(); myCamera.takePicture(null, null, getJpegCallback()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { myCamera

Strange behaviour with Camera and SurfaceView

不打扰是莪最后的温柔 提交于 2019-12-06 11:03:40
I'm going crazy with the use of SurfaceView. I've developed an app which takes pictures at fixed time intervals. It works well with my device with Androd 2.3. Here is a sample code: public class MainActivity extends Activity { private Camera mCamera; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button captureButton = (Button) findViewById(R.id.button_capture); captureButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { takeAPicture(); } } ); } private

How to take screenshot for Android Surface view

淺唱寂寞╮ 提交于 2019-12-06 10:52:22
问题 I'm try to implement Take a Screenshot form my camera Surface view through code. I able to do of those things, however the screenshot always appears black. Here is the Code. i have searched many links and implement my code. but still screenshot appear black. how to resolve this. please guide me. thanks public class Cam_View extends Activity implements SurfaceHolder.Callback { protected static final int CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE = 0; private SurfaceView SurView; private SurfaceHolder

pinch zoom effect with Android SurfaceView

耗尽温柔 提交于 2019-12-06 09:47:40
问题 I want to zoom SurfaceView so that,we can video player and camera too.I searched lot but didn’t found any proper guideline.Lot of question have been asked related to this but no proper solution I found.Actually For Pinch zoom we use Matrix but problem is that SurfaceView doesn’t support Matrix.so can any suggest me how to do this.I went through this for PinchZoom. Your proper guideline will be great appreciated.Thanks 回答1: You can set MarginLayoutParams properly. See source code below for

How to scroll off screen memory bitmap

跟風遠走 提交于 2019-12-06 08:54:28
Using below code to scroll I have a Surfaceview thread and an off canvas texture bitmap that is being generated (changed), first row (line), every frame and then copied one position (line) down on regular surfaceview bitmap to make a scrolling effect, and I then continue to draw other things on top of that. Well that is what I really want, however I can't get it to work even though I am creating a separate canvas for off screen bitmap. It is just not scrolling at all. I other words I have a memory bitmap, same size as Surfaceview canvas, which I need to scroll (shift) down one line every frame

Android SurfaceView drawing

喜夏-厌秋 提交于 2019-12-06 08:35:35
I am new in android. I reviewed two examples Custom View with User Interaction and Android SurfaceView . I want that in second example draw cicle similarly with first example. How I can do this? Second question is: when the run() method has to stop? I found solution. For correctly work of SurfaceView I had to set background of canvas. When I done it everything is working fine. Create A bitmap then draw on its canvas and then add this bitmap to an imageview. Create A bitmap: Bitmap bmp = Bitmap.createBitmap(width, height, config); Draw on the bitmap canvas Canvas cv = new Canvas(bmp); cv