surfaceview

Need some insight on this recurring issue, ANR keyDispatchingTimedOut

末鹿安然 提交于 2019-12-04 20:59:18
I have an app that keeps getting ANR in one specific component, and I cannot figure out what is hogging the cpu time. Lately I've been getting two kinds of ANR, a native and a wait. DALVIK THREADS: "main" prio=5 tid=1 NATIVE | group="main" sCount=1 dsCount=0 s=N obj=0x4001d8c0 self=0xccc8 | sysTid=10569 nice=0 sched=0/0 cgrp=default handle=-1345017816 | schedstat=( 9041503981 6690216078 17225 ) at android.view.Surface.lockCanvasNative(Native Method) at android.view.Surface.lockCanvas(Surface.java:314) at android.view.SurfaceView$3.internalLockCanvas(SurfaceView.java:773) at android.view

Navigationdrawer under MapFragment and CameraView (Surfaceview)

萝らか妹 提交于 2019-12-04 20:13:52
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 Reason: The CameraView and the MapFragment are SurfaceViews. Solution: <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <FrameLayout android:id="@+id/palce_map_here" android:layout_height="match_parent" android:layout_width="match

Can u ? How to anti alias for SurfaceView in android?

别来无恙 提交于 2019-12-04 20:01:39
This is a test project for antialias in Surface View and View, in the View : ( it's very good for antialias ) @Override protected void onDraw(Canvas canvas) { Paint p = new Paint(); p.setColor(Color.WHITE); canvas.setDrawFilter(new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG|Paint.FILTER_BITMAP_FLAG)); canvas.drawColor(Color.BLACK); Matrix mMatrix = new Matrix(); mMatrix.postScale(0.34f, 0.34f); canvas.drawBitmap(mBitmap, mMatrix, p); canvas.drawText("View Anti alias", 100, 300, p); } in the Surface View : ( ugly -_-!!) public void doDraw(Canvas canvas) { Paint p = new Paint(); p.setColor

Admob on surfaceview

萝らか妹 提交于 2019-12-04 19:36:43
I have an activity which has a surfaceview capturing whole screen. i want to put an admob ad on surfaceview. I found this link but it does not work. Any idea ? In your activity's onCreate: // Add admob ads. admobView = new AdView(this, AdSize.BANNER, "YOUR_UNIT_ID"); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); admobView.setLayoutParams(lp); RelativeLayout layout = new RelativeLayout(this); layout.addView(surfaceView); layout.addView

How to show SurfaceView on Lock Screen?

空扰寡人 提交于 2019-12-04 19:24:53
I'm working to implement a lock screen just like the water ripple lock screen of Samsung Galaxy 3. I have finished the GLSurfaceView object. But there is a problem when I port it to Lock Screen. The SurfaceView couldn't be displayed on Lock Screen whose window type is TYPE_KEYGUARD. If I use setZOrderOnTop(true) to this SurfaceView, it Can be displayed, but it will overlay all other layers of Lock Screen, which is not my anticipation. This SurfaceView can display normally on normal application. I used "adb shell dumpsys SurfaceFlinger" to dump the layers information. Its visibleRegionScreen is

Android SurfaceHolder.unlockCanvasAndPost() does not cause redraw

◇◆丶佛笑我妖孽 提交于 2019-12-04 19:22:26
问题 I'm implementing a fairly standard app with the Android sdk that involves drawing using the SurfaceView, SurfaceHolder, Callback setup. In my main thread (UI thread) I have no drawing or handling of the SurfaceHolder (or the canvas you retrieve with it). In a separate thread I have the following: Log.i("GAME.DrawThread", "run()"); Log.i("GAME.DrawThread", Thread.currentThread().getName()); Canvas canvas = null; try { canvas = holder.lockCanvas(); synchronized(holder) { Log.i("GAME", "draw()

How to retrieve the visible part of a SurfaceView in Android

折月煮酒 提交于 2019-12-04 17:20:21
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 of the SurfaceView (ideally as a bitmap) but if I try to do it by setting a PictureCallBack , the aspect

How to take screenshot for Android Surface view

帅比萌擦擦* 提交于 2019-12-04 17:10:43
I'm try to implement Take a Screenshot form my camera Surface view through code. I able to do of those things, however the screenshot always appears black. Here is the Code. i have searched many links and implement my code. but still screenshot appear black. how to resolve this. please guide me. thanks public class Cam_View extends Activity implements SurfaceHolder.Callback { protected static final int CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE = 0; private SurfaceView SurView; private SurfaceHolder camHolder; private boolean previewRunning; final Context context = this; public static Camera camera =

Custom camera app in android problems - rotation 270, stretched capture view and not getting all functions

霸气de小男生 提交于 2019-12-04 16:16:49
I got the help from code https://github.com/josnidhin/Android-Camera-Example But facing some problems like: How to add functionalities of auto focus and flash. - solved in last edited code The when screen orientation is 270 so real view shows 180 degree rotated. Capture view is showing stretched. The CODE from where i called the custom camera class Camera cam = Camera.open(); if (null == cam) { // no camera exists Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, RESULT_LOAD_IMAGE); } else { cam.release(); Intent

Android camera saving images with wrong orientation

你说的曾经没有我的故事 提交于 2019-12-04 15:38:53
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 = "orientation"; private static final String CAMERA_PARAM_LANDSCAPE = "landscape"; private static final