Board logo

標題: Android App - 設定使用限期 expiration date [打印本頁]

作者: admin    時間: 2012-2-20 11:19     標題: Android App - 設定使用限期 expiration date

要為Apps 設下使用限期,可加入

  1. protected void onResume()
  2. {
  3. super.onResume();
  4. Calendar expirationDate = Calendar.getInstance();
  5. expirationDate.set(2009,7,3);  
  6. //hardcoded expiration date,15th September would be: (2009, 8 , 15)        
  7. Calendar t = Calendar.getInstance();   
  8. //Calendar with current time/date
  9. if (t.compareTo(expirationDate) == 1)  
  10.      finish();
  11. }
複製代碼





歡迎光臨 How2Do (http://forum.how2do.com.hk/) Powered by Discuz! 7.2