surfaceview

SurfaceView.setbackground() dominates my canvas

那年仲夏 提交于 2020-01-04 02:48:47
问题 When I set the background to my surfaceview, I see what I set as the background. However, I cannot draw simple things like circles when I lock/unlock the surfaceview's canvas. All I see is the background image. Is there something I'm missing? Any thoughts? 回答1: You missed to google. http://android-er.blogspot.com/2010/05/android-surfaceview.html http://www.droidnova.com/playing-with-graphics-in-android-part-v,188.html 回答2: The solution is very simple. //get surface view and surface holder

TextureView functionality in Android pre-4.0?

丶灬走出姿态 提交于 2020-01-03 09:00:14
问题 I would like to know is there any way that I could get similar functionality to that of TextureView in the Android 2.2 or 2.33 environment? Specifically I am looking for a way to place a dynamic view (like SurfaceView) inside a ViewFlipper (as can be done with a TextureView). Any and all help with regard to this would be greatly appreciated. 来源: https://stackoverflow.com/questions/8784209/textureview-functionality-in-android-pre-4-0

Android Camera in View with Buttons and Text over

三世轮回 提交于 2020-01-03 03:37:08
问题 I implemented a Camera in my View like it is done in the API Demos. But it only works in the landscape mode. But that's not good for me, because I want to use it mostly in the portrait mode. So the buttons and so on look very bad. How is it possible to get a SurfaceView, which shows the CameraPreview and all together works in the protrait mode? I don't think that it is necessary to post the code because I just used the code form the API demos! Thank you very much! 回答1: If you do not specify

How to capture low resolution picture using android camera

大兔子大兔子 提交于 2020-01-02 07:25:23
问题 I want to capture photo and also save it to my sdcard using android camera.I know its easy but I want to store image in low resolution without telling user go to setting and set low resolution manually. 回答1: What i am gonna write is not good practice to do code but it may full-fill your requirement capture image as you do with normally using android default camera . check the path of that image which just now captured . reduce quality of that image as per requirement using BitmapFactory

why surfaceCreated and surfaceDestroyed called several times when set visibility with GONE and continue with VISIBLE?

社会主义新天地 提交于 2020-01-02 07:23:07
问题 i found that this codes will cause surfaceCreated and surfaceDestroyed to be called several times: mSurfaceView.setVisibility(View.GONE); mSurfaceView.setVisibility(View.VISIBLE); could anybody tell me why surfaceCreated and surfaceDestroyed doesn't to be called only once ? 回答1: If you implement SurfaceHolder.Callback and put a logger inside each of surfaceDestroyed , surfaceCreated , surfaceChanged methods, you will see that those two lines will generate the following output: 04-01 12:50:54

How to use my SurfaceView with main.xml on Android?

倾然丶 夕夏残阳落幕 提交于 2020-01-02 06:28:07
问题 In the main class of my project, I have public class MyClass extends Activity{ public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); mySurfaceView = new MySurfaceView(this); setContentView(mySurfaceView); ... } class MySurfaceView extends SurfaceView implements Runnable{ ... } } I want to add buttons and wheels to this program, which I have in a separate mini-program right now with a main.xml file. I know that to access that, I have to have the line

Switch To Front Camera and Back Camera Android SurfaceView

泄露秘密 提交于 2020-01-02 04:46:07
问题 I want to use the switch camera function. Currently I have Developed a Camera Object That working fine for back-camera but not working for front-camera. And I am unable to find a solution for switching between front and back cameras. Here is My Code..! public class MyCamera extends Activity implements SurfaceHolder.Callback, Camera.ShutterCallback, Camera.PictureCallback { Camera mCamera; SurfaceView mPreview; String filePath; @Override public void onCreate(Bundle savedInstanceState) { super

MediaCodec createInputSurface

做~自己de王妃 提交于 2020-01-02 02:02:13
问题 I want to use MediaCodec to encode a Surface into H.264. With API 18, there is a way to encode content from a surface by calling createInputSurface() and then drawing on that surface. I get IllegalStateException on createInputSurface(). Here's additional logcat output: D/H264Encoder(17570): MediaFormat: {frame-rate=25, bitrate=1000000, height=600, mime=video/avc, color-format=19, i-frame-interval=75, width=800} D/NvOsDebugPrintf( 125): NvMMLiteOpen : Block : BlockType = 4 D/NvOsDebugPrintf(

How to retrieve the visible part of a SurfaceView in Android

人走茶凉 提交于 2020-01-01 18:02:31
问题 I have a layout where the top part is used to display some data (eg. simple UI widgets) and the bottom part has a SurfaceView where I display a CameraPreview . In order for this SurfaceView to extend the whole width of the screen and at the same time maintain a correct aspect ratio, the SurfaceView actually goes offscreen which is fine since I actually want the app to be divided evenly between the top part and the bottom part. The problem is that I now want to retrieve only the visible part

Android camera saving images with wrong orientation

纵饮孤独 提交于 2020-01-01 17:15:50
问题 I have a camera app that uses only the portrait mode (restricted via android manifest file). Following code is my SurfaceView used for the Camera public class CameraPreview extends SurfaceView implements SensorEventListener, SurfaceHolder.Callback { private SurfaceHolder mSurfaceHolder; private Camera mCamera; private Activity mActivity; private static boolean DEBUGGING = true; private static final String LOG_TAG = "CameraPreviewSample"; private static final String CAMERA_PARAM_ORIENTATION =