surfaceview

Take camera screenshot while recording - Like in Galaxy S3?

心不动则不痛 提交于 2019-12-01 06:13:52
问题 Im developing a camera app which uses SurfaceView for display. I'm able to take screenshot of the SurfaceView (and save it as a bitmap) with getDrawingCache() (on a layout which wraps the SurfaceView) and also with canvas.drawBitmap(...) however in both ways, the bitmap is always transparent/blank. I have galaxy S3 and I can see that they have that feature in their camera how exactly they do it? thanks! 回答1: Well after hours, I got a nice solution for that. Maybe it isn't the best way, but it

Android glSurfaceView with overlay using XML/Java

白昼怎懂夜的黑 提交于 2019-12-01 04:57:49
I started an Android OpenGL application and I have the following classes: class A extends Activity class B extends GlSurfaceView implements Renderer When class A's onCreate is called, it creates an object of type class B and calls: setContentView(Bobject) So far it works and I spent a few days on it. Now I wanted to add buttons to my application and found the SurfaceViewOverlay example. That uses some XML to create a view hierarchy. I wanted to create something very similar to I simply cut and paste the XML code: <android.opengl.GLSurfaceView android:id="@+id/glsurfaceview" android:layout

Android glSurfaceView with overlay using XML/Java

痴心易碎 提交于 2019-12-01 02:34:53
问题 I started an Android OpenGL application and I have the following classes: class A extends Activity class B extends GlSurfaceView implements Renderer When class A's onCreate is called, it creates an object of type class B and calls: setContentView(Bobject) So far it works and I spent a few days on it. Now I wanted to add buttons to my application and found the SurfaceViewOverlay example. That uses some XML to create a view hierarchy. I wanted to create something very similar to I simply cut

Using a custom SurfaceView and thread for Android game programming (example)

前提是你 提交于 2019-12-01 00:36:13
I am trying to use SurfaceView, but the lockCanvas(null) is confusing, and the app freezes when I exit the activity. Also, nothing is displayed, even though the tutorial I was using was working perfectly fine, and I don't understand what I am doing wrong. Please help. The solution is probably that setWillNotDraw(false); was not called. Therefore, a referential implementation that works properly would be the following: public class GameSurfaceView extends SurfaceView implements SurfaceHolder.Callback { private SurfaceHolder holder; private MyThread myThread; private GameController

Handling two surfaceViews

纵饮孤独 提交于 2019-12-01 00:13:25
I have two surface Views 1> MediaRecorder display surfaceview. 2> MediaPlayer SurfaceView displaying the Media recorded by MediaRecorder. I want to display both the views simultaneously on the screen z ordered. The mediaPlayer will be palying in full screen and the MediaRecorderPreview shd appear in the top right corner with some smaller size. I am able to do this using two surfaces but the issue is that the MediaRecorder Preview always goes to the background z order and gets hidden by the mediaplayer full screen display. Is their any way to define the Z order of Surface View. Or is their any

Handling two surfaceViews

空扰寡人 提交于 2019-11-30 18:56:52
问题 I have two surface Views 1> MediaRecorder display surfaceview. 2> MediaPlayer SurfaceView displaying the Media recorded by MediaRecorder. I want to display both the views simultaneously on the screen z ordered. The mediaPlayer will be palying in full screen and the MediaRecorderPreview shd appear in the top right corner with some smaller size. I am able to do this using two surfaces but the issue is that the MediaRecorder Preview always goes to the background z order and gets hidden by the

Set Background color of Surface View

守給你的承諾、 提交于 2019-11-30 18:42:45
I want to set a background color to the surface view to my camera surface view. I am using this for implementing the same. But this example is not complete. Can anyone please help me with some other useful link. Thanks There's a workaround to do this. add a parent viewgroup for the surfaceview, set the background color to this viewgroup instead of the surfaceview; <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/holo_blue_dark"> <com.example.surfacetest.MySurface android:id="@+id/surface" android:layout_width="match_parent

The surface has been released when I try to setDisplay to MediaPlayer

夙愿已清 提交于 2019-11-30 17:18:33
My xml file: <SurfaceView android:id="@+id/surfaceView" android:layout_marginTop="50dp" android:layout_width="fill_parent" android:layout_height="300dp" /> My function to setDisplay: public void playVideo() { MediaPlayer mp = new MediaPlayer(); SurfaceView sv = (SurfaceView) this.findViewById(R.id.surfaceView); try { mp.setDataSource("sdcard/test/a.3gp"); SurfaceHolder sh = sv.getHolder(); mp.setDisplay(sh);***----the exception occured here*** mp.prepare(); mp.start(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } catch

VideoView on top of SurfaceView

假装没事ソ 提交于 2019-11-30 16:02:37
I try to show a VideoView on top of a SurfaceView . But it isn't visible but reacts on clicks (MediaController appears and the sound plays). The video seems to be played behind the SurfaceView so I also tried to make use of setZOrderMediaOverlay() and/or setZOrderOnTop() but nothing changed When I go to the home screen I see the VideoView for a split second in the fading animation, so it is really there. I tried it with a xml layout and also completely programmatically but nothing works. Here is my activity: public class VideoTest extends Activity { private RelativeLayout mLayout; private

Drawing to a SurfaceView in Android

↘锁芯ラ 提交于 2019-11-30 14:34:53
问题 I'm trying to do some very simple drawing into a SurfaceView but I can't get it working. There are no exceptions, but I don't see any result either. More precisely, I'm trying to create a SurfaceView and fill it with a single colour. Here goes my code: public class SvetlinSurfaceViewTestActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SurfaceRenderer renderer = new