2011年3月22日
摘要: 得到系统时间:Calendarc=Calendar.getInstance();Datedate=c.getTime();System.out.println(date.toLocaleString());这个可以得到2006-3-2916:10:36得到文件修改时间:importjava.util.*;importjava.io.*;publicclasstest{ publicstaticvoidmain(String[]args){ Filef=newFile("test.txt"); longtime=f.lastModified(); Calendarcal=Ca 阅读全文
posted @ 2011-03-22 16:04 shenshuyi 阅读(1221) 评论(0) 推荐(0) 编辑
摘要: 在做一个项目时,因为需要显示时间,要求显示格式与系统标题栏显示的时间格式一致,在网上找了很久没找到相关文档说明,后来在一本书上看到了。直接上源码: ContentResolver cv = this.getContentResolver(); String strTimeFormat = android.provider.Settings.System.getString(cv, android.provider.Settings.System.TIME_12_24); if(strTimeFormat.equals("24")) {Log.i("activity 阅读全文
posted @ 2011-03-22 16:02 shenshuyi 阅读(307) 评论(0) 推荐(0) 编辑
摘要: (1)、使用系统定义的Notification以下是使用示例代码: //创建一个NotificationManager的引用 String ns = Context.NOTIFICATION_SERVICE; NotificationManager mNotificationManager = (NotificationManager)getSystemService(ns); //定义Notification的各种属性 int icon = R.drawable.icon; //通知图标 CharSequence tickerText = "Hello"; //状态栏显示 阅读全文
posted @ 2011-03-22 00:01 shenshuyi 阅读(1419) 评论(1) 推荐(0) 编辑