随笔分类 -  Android之工具类

Android之文件搜索工具类
摘要:/** * @detail 搜索sdcard文件 * @param 需要进行文件搜索的目录 * @param 过滤搜索文件类型 * */ private void search(File file, String[] ext) { if (file != null) { if (file.isDirectory()) { File[] listFile = file.listFiles(); if (listFile != null) { ... 阅读全文
posted @ 2013-12-19 14:15 lee0oo0 阅读(1382) 评论(0) 推荐(0) 编辑
Android之录音工具类
摘要:/** * 录音工具类 * * @author rendongwei * */public class RecordUtil { private static final int SAMPLE_RATE_IN_HZ = 8000; private MediaRecorder recorder = new MediaRecorder(); // 录音的路径 private String mPath; public RecordUtil(String path) { mPath = path; } /** * 开始录音 *... 阅读全文
posted @ 2013-12-06 14:48 lee0oo0 阅读(797) 评论(0) 推荐(0) 编辑
Android之多种Bitmap效果
摘要:1.将图片变为圆角2.获取缩略图图片3.LOMO特效4.旧时光特效5.暖意特效6.根据饱和度、色相、亮度调整图片7.添加图片外边框8.添加内边框9.创建一个缩放的图片/** * 图片工具类 * * @author rendongwei * */public class PhotoUtil { /** * 将图片变为圆角 * * @param bitmap * 原Bitmap图片 * @param pixels * 图片圆角的弧度(单位:像素(px)) * @return 带有圆角的图... 阅读全文
posted @ 2013-12-06 14:46 lee0oo0 阅读(7590) 评论(1) 推荐(0) 编辑
Android之判断当前网络状态
摘要:/** * 检测网络是否可用 * @return */ public boolean isNetworkConnected() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ni = cm.getActiveNetworkInfo(); return ni != null && ni.isConnectedOrConnecting(); }... 阅读全文
posted @ 2013-09-25 23:55 lee0oo0 阅读(20002) 评论(0) 推荐(0) 编辑
Android之计算两个时间的相差
摘要:参数: sdate =2013-07-16 16:14:47/** * 以友好的方式显示时间 * @param sdate * @return */ public static String friendly_time(String sdate) { Date time = toDate(sdate); if(time == null) { return "Unknown"; } String ftime = ""; Calendar cal = Calendar... 阅读全文
posted @ 2013-07-17 00:03 lee0oo0 阅读(11598) 评论(1) 推荐(0) 编辑
Android之判断时间是否为今天
摘要:字符串: sdate = 2013-07-16 13:35:02/** * 判断给定字符串时间是否为今日 * @param sdate * @return boolean */ public static boolean isToday(String sdate){ boolean b = false; Date time = toDate(sdate); Date today = new Date(); if(time != null){ String nowDate = ... 阅读全文
posted @ 2013-07-16 23:15 lee0oo0 阅读(9506) 评论(0) 推荐(0) 编辑