@Override protected void onResume() { // 如果从后台恢复,服务被系统干掉,就重启一下服务 // TODO Auto-generated method stub newNum = application.getRecentNum(); // 从新获取一下全局变量 if (!application.isClientStart()) { Intent service = new Intent(this, GetMsgService.class); startService(service); } new SharePreferenceUtil(this, Constants.SAVE_USER).setIsStart(false); NotificationManager manager = application.getmNotificationManager(); if (manager != null) { manager.cancel(Constants.NOTIFY_ID); application.setNewMsgNum(0); // 把消息数目置0 application.getmRecentAdapter().notifyDataSetChanged(); } super.onResume(); }