/**
* Returns true if the string is null or 0-length.
* @param str the string to be examined
* @return true if str is null or zero length
*/
public static boolean isEmpty(CharSequence str) {
if (str == null || str.length() == 0)
return true;
else
return false;
}
类似的工具类还有android.media.ThumbnailUtils,用于生成缩略图。
更多的在/frameworks/base/core/java/android/util下
同样也可以参考/frameworks/base/core/java/android/下的很多包的代码,如
accessibilityservice animation app blcr content ddm emoji hardware net os pim provider service speech text util webkit
accounts annotation appwidget bluetooth database debug gesture inputmethodservice nfc package.html preference server sim test theme view widget
举例,animation包下的:
AnimatorInflater.java AnimatorSet.java FloatKeyframeSet.java Keyframe.java ObjectAnimator.java TimeAnimator.java ValueAnimator.java
Animator.java ArgbEvaluator.java IntEvaluator.java KeyframeSet.java package.html TimeInterpolator.java
AnimatorListenerAdapter.java FloatEvaluator.java IntKeyframeSet.java LayoutTransition.java PropertyValuesHolder.java TypeEvaluator.java