surfaceview

Android Camera - app passed NULL surface

僤鯓⒐⒋嵵緔 提交于 2019-12-10 01:14:33
问题 Whenever I run the cam_thread I get the error "app passed NULL surface". This code supposedly works on the HTC Incredible 1. I've reconfigured it slightly to run on a droid x. However I still get this error. public class Android_Activity extends Activity { Main_thread simulator; ToggleButton togglebutton; EditText ip_text; SensorManager sm = null; SurfaceView view; Sensors_thread the_sensors=null; String IP_address; Android_Activity the_app; @Override protected void onCreate(Bundle

android.view.Surface - OutOfResourcesException

微笑、不失礼 提交于 2019-12-09 19:10:21
问题 I have this strange bug, and found nothing about a possible solution to it. The problem always appears randomly after playing around a bit with my app. The app runs perfectly on almost all devices. Still one of the devices on which this issue is present is running CM 7.1.0 and I know that a lot of CM7 users were complaining about similar problems. Unfortunately I have some users that had the same issue with the app, but I don't know if they were using CM7 or not. Since I wasn't able to

Android SurfaceView Preview Blurry

天涯浪子 提交于 2019-12-09 18:00:59
问题 I have a quick question. I'm using Android's SurfaceView to take a picture and save it. However, the preview size and the picture quality itself is both terrible; as in, it is very blurry. There's no sharpness to the picture quality at all. Here's where I initialize my surfaceView: camera.setDisplayOrientation(90); Parameters parameters = camera.getParameters(); parameters.setWhiteBalance(Camera.Parameters.WHITE_BALANCE_AUTO); parameters.setExposureCompensation(0); parameters.setPictureFormat

Android Camera Live Filter

不打扰是莪最后的温柔 提交于 2019-12-09 16:45:36
问题 What is the best way for Camera Live filters. I am recently using GPUImage Library from Link: https://github.com/CyberAgent/android-gpuimagelibrary. Than I have found SurfaceView and GLSurfaceView. Problem is: How to apply live filter to camera using SurfaceView or GLSurfaceView. Thanks in advance. 回答1: This link uses Texture View https://github.com/google/grafika/blob/master/app/src/main/java/com/android/grafika/LiveCameraActivity.java This uses surface view to play a movie..u can manipulate

Android之SurfaceView(六)

 ̄綄美尐妖づ 提交于 2019-12-09 15:42:14
关于surfaceView相关知识: View和SurfaceView主要区别: View只能在UI线程中刷新,而 SurfaceView可以在子线程中刷新 SurfaceView可以控制刷新频率 SurfaceView几个重要的方法 继承 SurfaceView 后调用getHolder()方法可以获取到 mSurfaceHolder对象这个对于可以控制 SurfaceView的绘制 实现这个 SurfaceHolder.Callback接口并且 mSurfaceHolder.addCallback(this)添加回调可以感知到 SurfaceView的生命周期 绘制的时候mCanvas.drawColor(Color.BLACK);这个方法很重要,这个方法是清理上一次绘制的东西,这个方法一定要调用才能看到效果 实现效果 如下: 第一步:新建XRSurfaceView继承SurfaceView package com.rong.activity; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.util.AttributeSet; import

【Android游戏开发十六】Android Gesture之【触摸屏手势识别】操作!利用触摸屏手势实现一个简单切换图片的功能!

ぃ、小莉子 提交于 2019-12-09 15:34:28
李华明Himi 原创,转载务必在明显处注明: 转载自 【黑米GameDev街区】 原文链接: http://www.himigame.com/android-game/337.html 很多童鞋说我的代码运行后,点击home或者back后会程序异常,如果你也这样遇到过,那么你肯定没有仔细读完Himi的博文,第十九篇Himi专门写了关于这些错误的原因和解决方法,这里我在博客都补充说明下,省的童鞋们总疑惑这一块;请点击下面联系进入阅读: 【Android游戏开发十九】(必看篇)SurfaceView运行机制详解—剖析Back与Home按键及切入后台等异常处理! 本文补充: 网上很多关于手势文章都说Android 对手势的支持是从SDK 1.6 (也就是 API 4)才开始的,但是我用SDK1.5模拟器也能识别!。(本想测试下更低的SDK的支持效果,但是我没有SDK低于1.5版本的....我手机SDK 2.2的 - -、),所以查了Api 发现: android.view.GestureDetector.OnGestureListener; since api-1 , android.view.GestureDetector; since api-1 , 从API来看从api-1开始就已经支持手势和手势监听器了,那么很多说api-4才支持这句话也没错!因为: android

【Android游戏开发之六】在SurfaceView中添加组件!!!!并且相互交互数据!!!!

北城以北 提交于 2019-12-09 15:24:01
李华明Himi 原创,转载务必在明显处注明: 转载自 【黑米GameDev街区】 原文链接: http://www.himigame.com/android-game/306.html 很多童鞋说我的代码运行后,点击home或者back后会程序异常,如果你也这样遇到过,那么你肯定没有仔细读完Himi的博文,第十九篇Himi专门写了关于这些错误的原因和解决方法,这里我在博客都补充说明下,省的童鞋们总疑惑这一块;请点击下面联系进入阅读: 【Android游戏开发十九】(必看篇)SurfaceView运行机制详解—剖析Back与Home按键及切入后台等异常处理! 各位童鞋请你们注意:surfaceview中确实有 onDraw这个方法,但是surfaceview不会自己去调用!!! 而我代码中的ondraw 也好 draw 也好,都是我自己定义的一个方法。。。放在线程中不断调用的,一定要注意!! 昨天圣诞节,没有出去,而是一天时间全部纠结在如何在SurfaceView中添加组件,例如添加常用的Button,TextView等等、一开始也想着从网上找些资料看看有没有可参考的,但是发现搜到的结果仍是些童鞋对此很疑惑并且也在找寻答案,那么,这里就把圣诞节一天的成果来和各位童鞋分享; 1.因为我们的SurfaceView是个View对于添加的组件其实也是View

关于SurfaceView的问题

半世苍凉 提交于 2019-12-09 15:22:04
用SurfaceView写游戏的时候,遇见一个奇怪的问题。 程序运行->按HOME键 Activity调用的顺序是onPause->onStop SurfaceView调用了surfaceDestroyed方法 然后再切回程序 Activity调用的顺序是onRestart->onStart->onResume SurfaceView调用了surfaceChanged->surfaceCreated方法 切回后程序运行良好。 可按挂断键或锁定屏幕 Activity只调用onPause方法 解锁后Activity调用onResume方法 SurfaceView什么方法都不调用 但是不能更新屏幕。该问题只存在于真机上(在G2上测试),模拟器运行良好。 怀疑是不是SurfaceHolder不能获得Canvas,经过联机DEBUG,程序运行正常,还是不能更新屏幕,不知道是不是SurfaceView的bug。感觉SurfaceView不可见后,必须重新surfaceCreated才能正常工作。 解决办法 在onResume中调用setContentView( view ),SurfaceView会调用surfaceChanged->surfaceCreated方法。 来源: oschina 链接: https://my.oschina.net/u/16/blog/17049

Android: Is it possible to have two surfaceview on top of each other?

僤鯓⒐⒋嵵緔 提交于 2019-12-09 15:10:16
问题 My idea is to have two surfaceViews. One surfaceView which will hold an image (say ImageSurgaceView) and second surface that lie on top of the first one which holds the annotations (say AnnotationSurfaceView) like circle, rectangle etc. Now I have to map these surface views such that the height, width are same and moreover, both the surface view should move on drag i.e share the touch events. To be precise, when I move the image up the annotations should also move up. Now, I am not sure if

Android SurfaceView vs TextureView

我怕爱的太早我们不能终老 提交于 2019-12-09 14:55:28
This page is intended to briefly introduce the differences between SurfaceView and TextureView. SurfaceView and TextureView Both SurfaceView and TextureView are inherited from android.view.View class. They can be drawn and rendered from a separate thread, which is the major difference from other views. The feature of drawing separately is employed by Crosswalk to improve rendering performance greatly by a dedicated GPU thread. SurfaceView provides a dedicated drawing surface embedded inside of a view hierarchy. You can control the format of this surface and, if you like, its size; the