Intent intent2 = new Intent(this, DeskByTime.class);
startActivity(intent2);
break;
case 4:// 关于
Intent intent3 = new Intent(this, About.class);
startActivity(intent3);
break;
case 5:// 更新桌面
onCreate(null);
break;
default:
}
return super.onOptionsItemSelected(item);
}
public void initViews() {
packageManager = getPackageManager();
final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
List<HashMap<String, Object>> items = new ArrayList<HashMap<String, Object>>();
// get all apps
apps = packageManager.queryIntentActivities(mainIntent, 0);
for (ResolveInfo pi : apps) {
HashMap<String, Object> map = new HashMap<String, Object>();
PackageManager manager = this.getPackageManager();
map.put(“appIcon”, pi.loadIcon(packageManager));
map.put(“appName”, pi.loadLabel(packageManager).toString());
map.put(“appPack”, pi.activityInfo.packageName);
try {
map.put(“appTime”, Long.toString(manager.getPackageInfo(
pi.activityInfo.packageName, 0).firstInstallTime));
} catch (NameNotFoundException e) {
e.printStackTrace();
}
items.add(map);
}
// ToDB
db = new DbOperation(this);
long countlong = db.getCount(); // 获取数据库中记录数目
int countint = (int) countlong;
upCount = ite