开发问题笔记
来源:互联网 发布:mssql数据库备份分离 编辑:程序博客网 时间:2024/06/05 12:53
1. VideoView在设置match_parent的情况下无法全屏显示
2. 在xml中添加自定义控件时,需要这个(记录一下,省的每次找):
4. List删除元素方式抛异常
重写VideoView的onMeasure方法。
@Overrideprotected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int widthSize = MeasureSpec.getSize(widthMeasureSpec); int widthMode = MeasureSpec.getMode(widthMeasureSpec); int heightSize = MeasureSpec.getSize(heightMeasureSpec); int heightMode = MeasureSpec.getMode(heightMeasureSpec); if (widthMode == MeasureSpec.EXACTLY && heightMode == MeasureSpec.EXACTLY) { setMeasuredDimension(widthSize, heightSize); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); }}
2. 在xml中添加自定义控件时,需要这个(记录一下,省的每次找):
xmlns:app="http://schemas.android.com/apk/res-auto
3. ContentResolver.update()时,报NullPointerException
答:update时,Uri与ContentValu都不能为空
/** * Update row(s) in a content URI. * * If the content provider supports transactions the update will be atomic. * * @param uri The URI to modify. * @param values The new field values. The key is the column name for the field. A null value will remove an existing field value. * @param where A filter to apply to rows before updating, formatted as an SQL WHERE clause (excluding the WHERE itself). * @return the number of rows updated. * @throws NullPointerException if uri or values are null */ public final int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String where, @Nullable String[] selectionArgs) {
4. List删除元素方式抛异常
结论:ArrayList使用Iterator方法删除,CopyOnWriteArrayList使用remove方法删除。
原因:CopyOnWriteArrayList线程安全,他的Iterator返回的是数据的一份拷贝,可看源码说明。
ArrayList在for-each进行删除时容易出现问题,建议使用Iterator。
5. aar中有so,但是找不到
现象:
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.qihancloud.librarydemo-1/base.apk"],nativeLibraryDirectories=[/data/app/com.qihancloud.librarydemo-1/lib/arm, /data/app/com.qihancloud.librarydemo-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]] couldn't find "libuvcNative.so"
at java.lang.Runtime.loadLibrary(Runtime.java:367) at java.lang.System.loadLibrary(System.java:1076)
原因:当项目引用多个aar包,且aar中包含so库时,如果两个aar的so的文件夹不同,如‘arm’、‘armeabi-v7a’、‘x86’等,则会出现这个问题。
解决:从错误日志中,找到需要的文件包,添加相应的so库即可。如上面错误中,添加‘armeabi-v7a’文件夹。
阅读全文
0 0
- Android开发问题笔记
- 开发问题笔记
- Android开发笔记:问题集锦
- Cookie开发问题总结笔记
- 日常开发遇到问题笔记
- petalinux开发zynq问题笔记
- 微信开发问题笔记
- android 开发实战问题笔记
- 【treeview开发笔记(3)】速度问题告一段落
- iOS开发笔记--字符串连接问题
- iOS开发笔记--tableview重用问题
- web开发 笔记 - 中文编码问题
- kinect 开发笔记(问题汇总篇)
- 移动web项目开发问题笔记
- 常见iOS开发问题知识点笔记
- 安卓开发所遇问题笔记
- 开发笔记 - PHP返回的数据问题
- iOS开发笔记--字符串连接问题
- hihocoder 1195&1196
- GRFC (generic rf control)
- B树在存储中的作用和优点
- inno setup打包工具脚本
- 快速排序法 java实现 三种方法实现
- 开发问题笔记
- lintcode(127)拓扑排序
- android studio 导入module作为lib使用
- Android初级教程
- Eclipse Gradle插件相关快捷键
- 大型项目架构演进过程及思考的点
- <模型汇总_9> 深度学习网络的表达方式汇总及模型分类方法
- Android架构之项目组件化实战
- 在Ubuntu中安装Redis,设置密码,远程访问