surfaceview

Getting a frame from SurfaceView

…衆ロ難τιáo~ 提交于 2019-12-29 06:28:47
问题 The difficulty I am having now is to take a screenshot of the SurfaceView. Could anyone please help? My team is doing an Android project where we use MediaCodec to decode the video feed and render the feed onto a Surface. The activity implements SurfaceHolder.Callback Then we created a SurfaceView and add the Callback: mySurfaveView.getHolder().addCallback(this); Then we start decode the video feed in (we have a method that does the decode) surfaceChanged(SurfaceHolder holder, int format, int

how to pause and resume a surfaceView thread

允我心安 提交于 2019-12-28 03:23:07
问题 I have a surfaceView setup and running, but when I resume it I get an error that the thread has already been started. What's the proper way to handle when the app goes to the background and then back to the foreground? I've tinkered around and managed to get the app to come back without crashing... but the surfaceView doesn't draw anything anymore. My code: @Override public void surfaceCreated(SurfaceHolder holder) { Log.e("sys","surfaceCreated was called."); if(systemState==BACKGROUND){

Custom camera android

六月ゝ 毕业季﹏ 提交于 2019-12-27 12:44:04
问题 I want to use camera preview in an activity. I want to add images(transparent frames on surface view). I tried following code so that i can easily customize the xml layout desirably: package com.demo; import java.io.IOException; import android.app.Activity; import android.graphics.PixelFormat; import android.hardware.Camera; import android.os.Bundle; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.widget.Toast; public class CameraDemoActivity extends

Open Camera in a blank surfaceView

耗尽温柔 提交于 2019-12-25 18:37:05
问题 I am very new to android programming and All I want to do is open camera app in surface view so that I can open camera into it and set some parameters like following? Camera camera = Camera.open(); Parameters p = camera.getParameters(); p.setFlashMode(Parameters.FLASH_MODE_ON); camera.setParameters(p); camera.startPreview(); camera.release(); I came across comments saying that I HAVE to pass a surface. so I have created following surface: package com.example.fcloader; import java.io

How to create surfaceview with rounded corners

谁说胖子不能爱 提交于 2019-12-25 14:05:23
问题 I am having a difficulty to round the corners of surfaceview. I am using MjpegView (custom view that inherit from surfaceview. I tried already this solutions: 1) set background with custom drawable with round corners 2) After reading this post http://androidtutorialsandtips.blogspot.co.il/2012/01/overriding-ondraw-method-in-surfaceview.html I am not sure how to implement the round corners as I have already implemented a thread that locks the canvas. while (mRun) { if (surfaceDone) { try { c =

Android image timing issues

旧巷老猫 提交于 2019-12-25 07:34:46
问题 I have an Android app that needs to display images and videos in a loop, it has no problem with playing the videos, but when it gets to the images the screen goes blank and nothing happens. the program is still running just not displaying. I'm using SurfaceView.setBackground() to draw the image because swapping between an ImageView and the SurfaceView that the videos are played on has caused problems before. I was having a similar issue when displaying the videos and I solved it by removing

Writing to an Android display from ndk

眉间皱痕 提交于 2019-12-25 04:42:37
问题 Writing directly to the framebuffer no longer works. Is there anyway to write to the display in the NDK? I might use ANativeWindow but that requires an existing surface. Is there a better way? Or is the only way to create a surface, natively, and then use ANativeWindow? 回答1: The display is owned by SurfaceFlinger and Hardware Composer, so unless you're planning to halt the Android framework you will need to work through them. (See the graphics architecture doc for more details.) If you're

Organizing methods between SurfaceView and Activity

社会主义新天地 提交于 2019-12-25 04:19:00
问题 For two days I have been trying to show the camera in a view. I followed many tutorials like these two: http://code.google.com/p/openmobster/wiki/CameraTutorial http://developer.android.com/training/camera/cameradirect.html but without success to show the camera on the screen. I finally found this which works directly. Just had to remove one deprecated method. From that one I tried to build something similar to the example in the two first sites, but I cannot get it working. At this line:

Android JNI C++ Code always get “same” jobject value for 2 different SurfaceView object

喜夏-厌秋 提交于 2019-12-25 03:02:45
问题 In Android JAVA code: public native int addRenderer(int channel, Object glSurface); Context context = getApplicationContext(); SurfaceView svRemotePartyA = new SurfaceView(context); SurfaceView svRemotePartyB = new SurfaceView(context); addRenderer(0, svRemotePartyA); addRenderer(1, svRemotePartyB); In Android JNI C++ code: extern "C" jint JNIEXPORT JNICALL Java_addRenderer( JNIEnv* jni, jobject j_vie, jint channel, jobject surface) { LOG(LS_INFO) << "Java_addRenderer(): surface=" << surface;

How to take images only within the bounding box in android custom camera

℡╲_俬逩灬. 提交于 2019-12-25 02:54:27
问题 Recently, I found a app that captures only the images within the boxes like the image below. Should I use a SurfaceView ? or are there some other technique to do this ? I made a camera app with surfaceview and thinking about implementing a blue box like the image below so that I can take the images within the 2 blue boxes. 回答1: You can captures the whole image, but just crop the target area after capturing. :) 来源: https://stackoverflow.com/questions/29715313/how-to-take-images-only-within-the