Java泛型函数的运行时类型检查的问题
摘要:在一个数据持久化处理中定义了数据保存和读取的 泛型函数的,但是在运行时出现类型转换错误,类型不匹配,出错的位置不是load方法,而是在调用load方法之后,得到了列表数据,对列表数据进行使用时出现的。结果列表里面的元素实际是A类型,调用load方法传递的是B类型的class,但是仍然load成功。
阅读全文
posted @
2017-05-26 12:19
虫子CCC
阅读(4495)
推荐(0)
Android代码的几点小技巧
摘要:1)View的状态保存与恢复dispatchRestoreInstanceStateonRestoreInstanceStateonSaveInstanceState2)Service的前台服务使用startForeground(NOTIFICATION_ID, mNotification)stop
阅读全文
posted @
2017-05-26 11:47
虫子CCC
阅读(234)
推荐(0)
关于矢量图片资源向后兼容:CompatVectorFromResourcesEnabled标志的使用
摘要:StackOverflow上摘抄的: some things have changed since I asked this question so I will answer it myself.With Support Library 23.4.0 the support for VectorD
阅读全文
posted @
2017-05-26 11:44
虫子CCC
阅读(4205)
推荐(0)
指定Android Studio编译工程时的源文件编码
摘要:统一设置为UTF8编码在工程的根目录下的build.gradle文件中,添加定义。tasks. withType(JavaCompile) { options.encoding = "UTF-8"} 如图:
阅读全文
posted @
2017-05-26 11:35
虫子CCC
阅读(379)
推荐(0)
安卓日历同步的一些要点
摘要:1)API接口 android.content.ContentProvider android.content.ContentResolver android.provider.CalendarContract 另外,在创建日历账号时(向系统的Calendars表插入一条数据)需要设置为适配器模式,
阅读全文
posted @
2017-05-26 11:23
虫子CCC
阅读(1343)
推荐(0)
Android Studio编译错误:Unexpected lock protocol found in lock file. Expected 3, found 0.
摘要:如果不小心手动修改了.gradle文件夹中的内容,那么再打开之前编译成功的工程时,会出现类似下面的错误: Gradle app neame project refresh failed: Unexpected lock protocol found in lock file. Expected 3,
阅读全文
posted @
2017-05-26 10:42
虫子CCC
阅读(9506)
推荐(1)