2015年5月11日

android 检测是否插入U盘方法之一

摘要: 本方法是检测文件/proc/partitions。import java.io.*;File Usbfile = new File("/proc/partitions");if(Usbfile.exists()){ try { FileReader file= new FileReade... 阅读全文

posted @ 2015-05-11 11:21 黑大米 阅读(3974) 评论(0) 推荐(0) 编辑

打印文件名、函数名和行号的方法

摘要: java打印文件名、函数名和行号的方法:Log.d(TAG, new Exception().getStackTrace()[0].getMethodName()); //函数名Log.d(TAG, Thread.currentThread().getStackTrace()[2].getMet... 阅读全文

posted @ 2015-05-11 10:54 黑大米 阅读(538) 评论(0) 推荐(0) 编辑

android Button获取焦点

摘要: 有时直接使用requestFocus()不能给button设置焦点,经网上查找得到如下结论:先setFocus,再requestFocus。 btn.setFocusable(true); btn.setFocusableInTouchMode(true); b... 阅读全文

posted @ 2015-05-11 10:47 黑大米 阅读(459) 评论(0) 推荐(0) 编辑

导航