surfaceview

Problem with surfaceview

此生再无相见时 提交于 2019-12-13 19:29:49
问题 I have a problem with the flickering. Here is my code. public class Tutorial2D3 extends Activity { Panel panel; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); panel = new Panel(this); setContentView(panel); } @Override public boolean onCreateOptionsMenu(Menu menu) { menu.add(1, 1, 1, "Clean Canvas"); return super.onCreateOptionsMenu(menu); } @Override public boolean onMenuItemSelected(int

Camera orientation and preview size

纵饮孤独 提交于 2019-12-13 17:24:37
问题 I just need some clarification with something regarding camera previews In Android developer documentation they have this under the description for setPreviewSize() : DIRECT LINK suppose the camera supports both 480x320 and 320x480 preview sizes. The application wants a 3:2 preview ratio. If the display orientation is set to 0 or 180, preview size should be set to 480x320. If the display orientation is set to 90 or 270, preview size should be set to 320x480. The display orientation should

Android SurfaceView: Show Video after Images

妖精的绣舞 提交于 2019-12-13 16:01:42
问题 I want to play a video after a couple of images in the same SurfaceView. If I show images AFTER videos, everything works fine. But if I want to play a video after the images, the SurfaceView stays blank (black). Can anyone help? It seems to be a problem of clearing or resetting the SurfaceView! The code of the SurfaceView (custom SurfaceView!!!): public class MySurfaceView extends SurfaceView implements SurfaceHolder.Callback, MediaPlayer.OnCompletionListener { private Bitmap image; private

Navigationdrawer under MapFragment and CameraView (Surfaceview)

邮差的信 提交于 2019-12-13 12:21:05
问题 I have a bug with the google maps fragment. The fragment is placed inside my activity and when i open the navigation drawer it is displayed behind the maps fragment. that's strange because the navigation drawer is on top of the fragment in the layout. Same problem with the CameraView. problem detected on android 2.3 and some 回答1: Reason: The CameraView and the MapFragment are SurfaceViews. Solution: <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent">

Android: Custom Surface View crashing upon orientation change

北城以北 提交于 2019-12-13 07:06:37
问题 I was reading this tutorial on how to use a custom surface view class in an XML layout and when I ran the code, the app crashed when my phone's orientation changed. I've noticed a lot of examples involving custom threads and surface view subclasses crashing when the orientation changes, does anybody have any idea why this is happening? 09-25 18:19:40.639: E/Trace(4982): error opening trace file: No such file or directory (2) 09-25 18:19:40.639: D/ActivityThread(4982): setTargetHeapUtilization

Android Canvas SurfaceView black screen

一世执手 提交于 2019-12-13 05:14:49
问题 I have a following class: public class GameView extends SurfaceView implements SurfaceHolder.Callback { public static final int WIDTH = 860; public static final int HEIGHT = 480; int x = 0; GameLoop gameLoop; public GameView(Context context) { super(context); getHolder().addCallback(this); setFocusable(true); } public GameView(Context context, AttributeSet attrs) { super(context, attrs); getHolder().addCallback(this); setFocusable(true); } public GameView(Context context, AttributeSet attrs,

Drawing using the Surfaceview creates blank screen

廉价感情. 提交于 2019-12-13 04:29:15
问题 I am creating a mind game based upon pictures . So i have to add a Matrices of images . I m using the surface view to run my thread so as to draw the content on to the screen by locking the screen to the canvas and bitmaps will be drawn inside the canvas . Here is my code . There is no error but a blank screen is displayed . What should i do ? Get me a solution public class InsideSurface extends SurfaceView implements Runnable { SurfaceHolder ourHolder; int start;//starting position to draw

Displaying a Bitmap on Canvas in Surfaceview

喜欢而已 提交于 2019-12-12 18:16:44
问题 I am trying to develop an android application to display a zoom-able, pan-able map, (which is just a bitmap image), that also allows the user to click on certain points on the map. I am struggling to find the most effective way of implementing such an app. After trying numerous other methods, (including Webviews, OpenLayers), the best way, (according to this site at least), seems to be using a SurfaceView with a Canvas. The code I have so far is pieced together from snippets I found all over

Android Game Leaking memory because of GLThread reference

倖福魔咒の 提交于 2019-12-12 17:22:19
问题 Right now I'm developing a game in Android (OpenGL ES 1.1) and I'm seeing that whenever I create a new SurfaceView (GLView) its thread is created. That's ok. The problem comes when I want to finish the Activity that holds the SurfaceView (and go back to the menu). It seems that the activities are not released because each GLThread is referencing it. This may finish with an OOM error. Some MAT pictures: The first picture: the MarkitActivity represents each single instance of the Activity that

Canvas object must be the same instance that was previously returned by lockCanvas

自闭症网瘾萝莉.ら 提交于 2019-12-12 16:25:43
问题 I have a custom SurfaceView with a method doDraw() that draws a background and a bitmap. The problem is when I run this I get an error Caused by: java.lang.IllegalArgumentException: canvas object must be the same instance that was previously returned by lockCanvas I don't see why this is happening. I don't declare any other canvases anywhere else in my code. I only have two other classes, MainActivity and SurfaceViewExample. MainActivity just has an intent to open SurfaceViewExample, and