Android(Java):长时间未登录提醒
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
currentTime = System.currentTimeMillis();
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
if(currentTime!=0 && System.currentTimeMillis() - this.currentTime > PERIOD){
new AlertDialog.Builder(this)
.setTitle("提示")
.setMessage("您已10天未在线登录,为了您的账号安全请重新登录")
.setPositiveButton("确定",new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface paramDialogInterface,
int paramInt) {
// TODO Auto-generated method stub
//GlobalModel.getInstance().getDownloadTask().removeAllTast();
Intent intent = new Intent(MainActivity.this, LoginActivity.class);
startActivity(intent);
MainActivity.this.finish();
}
}).show();
}
}
更多相关文章
- Android(安卓)代码片段---从相册或相机获取图片保存并处理
- Android(安卓)按钮 弹出对话框
- Android(安卓)- 对话框(Dialog)和通知(Notification)2
- android mapview
- android 弹出带按钮的对话框
- android mapview
- android登录简单窗口
- 基于Android的短信管理系统
- android Multiple markers at this line - The type java.lang.C