• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






♂小旭

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理

2013年11月26日

Android流量统计TrafficStats类的使用
摘要: 对于Android流量统计来说在2.2版中新加入了TrafficStats类可以轻松获取,其实本身TrafficStats类也是读取Linux提供的文件对象系统类型的文本进行解析。android.net.TrafficStats类中,提供了多种静态方法,可以直接调用获取,返回类型均为 long型,如果返回等于-1代表 UNSUPPORTED 当前设备不支持统计。Java代码static long getMobileRxBytes() //获取通过Mobile连接收到的字节总数,不包含WiFistatic long getMobileRxPackets() //获取Mobile连接收到的数据包总 阅读全文
posted @ 2013-11-26 18:19 ♂小旭 阅读(458) 评论(0) 推荐(0)
 
Android通过包名获取应用UID
摘要: try { PackageManager pm = getPackageManager(); ApplicationInfo ai = pm.getApplicationInfo("com.gesoft.bit.lavendercloud", PackageManager.GET_ACTIVITIES); Log.d("!!", "!!" + ai.uid); } catch (NameNotFoundException e) { e.printStackTrace(); } 阅读全文
posted @ 2013-11-26 18:18 ♂小旭 阅读(5837) 评论(0) 推荐(0)
 
Android获取手机通讯记录
摘要: StringBuilder smsBuilder1 = new StringBuilder();String str = null;String strNumber,strName = ""; int type; long callTime; Date date; String time= ""; ContentResolver cr = getContentResolver(); final Cursor cursor = cr.query(CallLog.Calls.CONTENT_URI, new String[]{CallLog.Calls.NU 阅读全文
posted @ 2013-11-26 17:14 ♂小旭 阅读(268) 评论(0) 推荐(0)
 
Android string字符串中首行缩进
摘要: \u3000 阅读全文
posted @ 2013-11-26 16:25 ♂小旭 阅读(669) 评论(0) 推荐(0)
 
android开发——自定义弹窗(PopupWindow)
摘要: LayoutInflater inflater = LayoutInflater.from(this); // 引入窗口配置文件 View view = inflater.inflate(R.layout.statement, null); Button btn = (Button) view.findViewById(R.id.btn); btn.setOnClickListener(ClickListener); // 创建PopupWindow对象 并设置高度和宽度 pop = new PopupWindow(view, 1000, 700, false); // 需要设置一... 阅读全文
posted @ 2013-11-26 13:55 ♂小旭 阅读(723) 评论(0) 推荐(0)
 
Android TextView 显示不同颜色的字
摘要: Spanned text = Html.fromHtml("沈阳" + "小旭");textView.setText(text); 阅读全文
posted @ 2013-11-26 11:40 ♂小旭 阅读(251) 评论(0) 推荐(0)
 
获取Android手机中所有的短信
摘要: 转自:http://android.tgbus.com/Android/tutorial/201104/349808.shtmlpublic String getSmsInPhone() { final String SMS_URI_ALL = "content://sms/"; final String SMS_URI_INBOX = "content://sms/inbox"; final String SMS_URI_SEND = "content://sms/sent"; final String SMS_URI_DRAFT 阅读全文
posted @ 2013-11-26 09:55 ♂小旭 阅读(963) 评论(0) 推荐(0)