admin管理员组

文章数量:1558103

 /**
     * 时间判断
     */
    private void limited() {
        Time t = new Time(); // or Time t=new Time("GMT+8"); 加上Time Zone资料。
        t.setToNow(); // 取得系统时间。

        String time = t.year + "年 " + (t.month + 1) + "月 " + t.monthDay + "日 "
                + t.hour + "h " + t.minute + "m " + t.second;
        Log.e("msg", time);
        //if (t.year == 2014 && t.month + 1 == 9 && t.monthDay == 23) 测试
//        if(t.year!=2020 || (t.month+1)!=5)//这个月
//         if(t.year!=2020 || (t.month+1)!=6||t.monthDay!=10) //今天
        int mYear=2020,myMonth=6,myMonthDay=30;
        if(t.year==mYear && (t.month+1)==myMonth && t.monthDay>=myMonthDay)
        {
            closeApp();
        }else if (t.year>mYear){
            closeApp();
        }else if (t.year==mYear && (t.month+1)>myMonth){
            closeApp();
        }
    }

    /**
     * 退出APP
     */
    private void closeApp(){
        Toast.makeText(IndexMainActivity.this,"试用版时间到自动退出,请联系软件作者微信:18977092827" ,
                Toast.LENGTH_LONG).show();

        new Handler().postDelayed(new Runnable(){   //延迟执行
            @Override
            public void run(){
                android.os.Process
                        .killProcess(android.os.Process
                                .myPid()); // 终止线程
            }
        }, 3000);
    }

本文标签: 时间androidapp