- 博客(17)
- 收藏
- 关注
原创 Obfuscate library project
对library project的混淆需要在主工程的混淆配置文件中设置参考:https://stackoverflow.com/questions/10982344/is-proguard-cfg-needed-for-library-projects#10992604https://stackoverflow.com/questions/8088958/how-to-obfuscate-...
2017-06-07 11:56:18
246
原创 Custom indeterminate ProgressBar
自定义 Indeterminate ProgressBar:先定义一个ring shapecustom_progress_bar.xml[code="java"] [/code]直接在layout中使用[code="java"][/code]注意定义上面的android:minWidth,...
2017-06-05 15:36:31
230
RemoteViews 之内存泄漏
最近实现了一个自定义Notification功能,使用RemoteViews展示。由于该notification是个ongoing的类型,更新比较频繁,于是想当然的把RemoteViews缓存起来,每次重更新文本,图片。 功能一直正常,直到后来碰上TransactionTooLargeException,应用crash。分析代码发现不应该出现notification parcel size过大的情...
2017-03-17 15:25:19
527
原创 定制页面背景及Actionbar overflow menu的背景色
定义theme和style, 注意是actionOverflowMenuStyle 和 android:windowBackground.(实测5.1.1和7.1.1) @style/CustomActionOverflowMenuStyle @android:color/white false ...
2017-02-28 13:38:55
341
原创 基于BouncyCastle的ECDSA Key, CSR, Certificate Demo
直接代码示例:[code="java"]import com.google.common.base.Splitter;import org.ethereum.crypto.jce.SpongyCastleProvider;import org.spongycastle.asn1.ASN1ObjectIdentifier;import org.spongycastle.asn1....
2017-02-27 18:13:07
1369
原创 如何判断APP是否在后台
可用辅助方法:[code="java"]public static boolean isInBackground(Context context) { ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); List runnin...
2016-07-08 16:50:58
340
原创 Notification启动broadcast失败
手机启动后,后台broadcast满天飞。可能点击自己应用的Notification 启动的broadcast半天不响应。这时候加上FLAG_RECEIVER_FOREGROUND吧。注意此flag在API 16中引入.示例:[code="java"]Intent intent = new Intent(context, XXXReceiver.class);if (andro...
2016-07-08 09:17:25
323
原创 Disable Runtime permision后恢复Activity
设备M或者M以上,当用户手动在系统设置中disable掉应用任何runtime permission时,运行的应用process会被kill掉,重回前台的时候,系统会恢复应用的task。但是这里需要注意Activity恢复的相关处理:1. 如果你的页面是通过onSaveInstanceState和onRestoreInstanceState记录状态并恢复的。那么恭喜你,你不需要做额外的工作。...
2016-07-08 09:15:55
180
原创 FLAG_ACTIVITY_REORDER_TO_FRONT之ANR问题(Android L)
Issue: https://code.google.com/p/android/issues/detail?id=169768问题摘要:===============================================================1)The app starts with Activity A, which simply shows a butto...
2016-07-07 15:21:00
293
原创 内存泄漏之TextLine.recycle
Issue: https://code.google.com/p/android/issues/detail?id=59310android.text.TextLine has memory leak on mSpanned and SpanSet.使用下面的工具类移除泄漏:[code="java"]public class TextLineRecycler { pr...
2016-07-07 14:59:21
372
原创 Release from App standby(Android M)
If app is in standby state, network access is unavailable.The system will release app from the standby state if it shows a toast.所以当你处于standby,又想使用网络的情况,简单的先show一个toast。...
2016-07-07 12:12:47
140
原创 定时执行alarm(Android M)
由于Android M上的doze mode,AlarmManager#setExact等并不能保证按时执行alarm。可用AlarmManager#setAlarmClock。
2016-07-07 12:10:20
176
原创 No Crypto provider (Android N)
Android N does not support "Crypto" provider any more.Solution:Switch to use SecretKeySpec to load raw key bytes directly for N if want to decrypt old info.The raw key bytes can be got by prev...
2016-07-07 12:03:57
209
原创 自定义link click
1. MyLinkify extends Linkify, add custom sub class of URLSpan to addLinks. Use MyLinkify to apply span to string or textview.2. If textview is linkable, get all URLSpan from the Spannable text. Us...
2010-08-08 17:09:57
1198
原创 textview highlight
1.SpannableStringBuilderexample:[code="java"]String str = "highlight me!";String highLight = "me";int start = str.indexOf(highLight);SpannableStringBuilder style=new SpannableStringBuilder(s...
2010-07-31 16:53:50
176
原创 textview scroll
1.嵌套在ScrollView中example: [b] [/b] 2. android:maxLines + an...
2010-07-31 16:44:11
187
原创 android.mk 引用第3方jar包 example
LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE_TAGS := user eng###############################LOCAL_STATIC_JAVA_LIBRARIES := lib3party###############################.....
2010-07-27 21:46:05
142
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人