All Projects → peerless2012 → AndroidBasis

peerless2012 / AndroidBasis

Licence: other
Android基础总结

AndroidBasis

Android笔记

一分钟实现一个RoundImageView

利用RoundedBitmapDrawableFactory快速实现一个RoundImageView

利用Proguard移除无用代码以及碰到的坑

利用Proguard移除代码中无用code,例如log。

Api21以下的LayoutInflater中setFactory2的bug是怎么产生的

对于Api >=11 并且 < 21,在FrameWork层有一个阻止已经设置Factory2的LayoutInflater的clone对象的Factory2的没有正确合并的bug。

那么这个bug是怎么产生的?又是怎么解决的?

背景透明的Dialog

Android中用style的方式实现背景透明的对话框。

初识Realm

Realm 让你能够高效地编写 app 的模型层代码,保证你的数据被安全、快速地存储。它具有 跨平台简单易用可视化 的特点。

所以,赶快开始吧!

Only the original thread that created a view hierarchy can touch its views. 是怎么产生的

我们都知道,在Android里面,只有主线程(MainThread)才可以更新ui,比如设置TextView的文本内容,ImageView的图片等等。

只要我们在非主线程去操作ui界面,就是抛出"Only the original thread that created a view hierarchy can touch its views."的异常。那么这个异常时怎么抛出来的呢?

带有极光推送的项目导出apk的时候出现 ClassCastException

项目中集成的有极光推送,debug模式下没有问题,当要导出成apk的时候碰到两种类型的错误:

  • Warning: android.support.v4.app.AppOpsManagerCompat23: can't find referenced method 'java.lang.Object getSystemService(java.lang.Class)' in class android.content.Context

  • java.lang.ClassCastException: java.lang.Object cannot be cast to java.lang.String

服务或广播中无法启动设备管理员激活界面的问题

Service或者BroadCastReceiver中启动Activity的话需要加上一个Intent.FLAG_ACTIVITY_NEW_TASK标记,一般情况下都是好用的,但是有一个需求是在开机广播中启动设置中的设备管理员激活界面,但是发现无法弹出该页面。

RadioGroup的onCheckedChanged回调两次的原因

有的时候我们会使用RadioGroup + RadioButton + Fragment来切换主界面的Fragment,但是我们需要在进入的时候默认选择一个,这个时候就会手动调用RadioGroup的 public void check(int id)方法,但是这个时候我们就会发现public void onCheckedChanged(RadioGroup group, int checkedId);方法会调用两次.当然这肯定不是我们想要的.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].