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();
  }
 }

發佈了51 篇原創文章 · 獲贊 2 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章