surfaceview

onLongPress not working as expected

℡╲_俬逩灬. 提交于 2019-12-10 17:35:08
问题 I am having a surfaceview on which gesture detection is implemented using following code. surfaceview.setOnTouchListener(new OnSwipeTouchListener(this ) { }); public class OnSwipeTouchListener implements OnTouchListener { private final GestureDetector gestureDetector; public OnSwipeTouchListener(Context ctx) { gestureDetector = new GestureDetector(ctx, new GestureListener()); } public boolean onTouch(final View view, final MotionEvent motionEvent) { return gestureDetector.onTouchEvent

Get GPU info on Android without SurfaceView

本秂侑毒 提交于 2019-12-10 16:07:46
问题 On Android, is there a way to get GPU information without creating a SurfaceView? I'm not looking to draw anything using OpenGL, but I just need to get hardware information like vendor, OpenGL ES version, extensions available etc. 回答1: I am sorry I am not sure how to do that with Android but the function glGetString allows you to access the OpenGL information. Here is a sample C++ style code that will output the extensions supported by your hardware that I hope you'll be able to adapt to

programmatically adding SurfaceView to a FrameLayout which is Z-ordered under ImageView

99封情书 提交于 2019-12-10 13:57:50
问题 EDIT 2a: feel free to jump to the bottom for succinct questions. I can Draw a SurfaceView via xml. In my case, I am creating an e-book which will have different animations running on SurfaceViews for each page of the book. I've got a .xml layout that has a FrameLayout called @+id/animation_layout . <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout

Google OCR working on specific area

大憨熊 提交于 2019-12-10 13:49:45
问题 I am currently using a SurfaceView and CameraSource from com.google.android.gms.vision to capture detected text on the image, but since it captures everything on the SurfaceView area, I need to discard some of the recovered things. The goal is making the SurfaceView to work like in the next image, ignoring all detected text in red crossed area, and giving to me only the things on the blue square. Is this even possible? Here is the layout (nothing special): <?xml version="1.0" encoding="utf-8"

Draw object's trails on a SurfaceView

删除回忆录丶 提交于 2019-12-10 11:56:24
问题 I have to simulate the motion of some objects, so I have created a SurfaceView on which I draw them with a dedicated Thread. Every loop I call canvas.drawColor() to clean up all previous object's positions and to draw the new states. Everything works fine and the frame rate is decent. The problem is: what if I want to draw the trails of the objects' trajectories? In that case I have to memorize the positions for every object and, at every loop, draw all past positions that are hundreds of

onPreviewFrame not being called for every frame that is displayed on SurfaceView

怎甘沉沦 提交于 2019-12-10 11:49:31
问题 My subclass of SurfaceView implements Camera.PreviewCallback & SurfaceHolder.Callback . private SurfaceHolder mHolder; private Camera mCamera; private final FPSCounter fpscounter = new FPSCounter(); public MySurfaceView(Context context, AttributeSet attrs) { super(context, attrs); mHolder = getHolder(); mHolder.addCallback(this); } @Override public void onPreviewFrame(byte[] data, Camera camera) { fpscounter.logFrame(); Log.d("fps", String.valueOf(fpscounter.getLastFrameCount())); } @Override

Android SurfaceView drawing

南楼画角 提交于 2019-12-10 10:46:03
问题 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? 回答1: I found solution. For correctly work of SurfaceView I had to set background of canvas. When I done it everything is working fine. 回答2: Create A bitmap then draw on its canvas and then add this bitmap to an imageview. Create A bitmap: Bitmap

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

我与影子孤独终老i 提交于 2019-12-10 10:45:25
问题 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());

Android: How to draw on a Surfaceview which already is displaying a Camara Preview

孤街浪徒 提交于 2019-12-10 10:27:52
问题 I am trying to program an application which has to display on the mobile phone's screen what is being filmed by the front camera [The application is not recording/saving anything in the memory of the phone]. Also in case a face is filmed (and detected), it has to appear sourrended by a rectangle. To do so I'm using: A Surfaceview to display what is being filmed by the front camera. A FaceDetectionListener to detect faces in the camera input. So far the application displays properly what is

Change size of Android custom SurfaceView

一笑奈何 提交于 2019-12-10 10:15:58
问题 I'm trying to create a 2D game engine for an Android app. I've followed this tutorial, which works fine for creating a full screen display, but I don't want that. I want to make my view take the top 2/3 (or whatever) of the screen, and fill the bottom third with standard Android widgets (buttons, text entry, etc.). I cannot get this to work. The best I can get is a blank white screen. I've tried many permutations, including using an outer LinerLayout, then embedding the custom SurfaceView