I am installing this application on the said tablet and I intend to supply this tablet to my client for a day or two, what I want is:
After checking the operations, the client should not be able to use the said application after the expiry date. for this I am calling the calander function and comparing the extracted system date (Day) with a day I want the application to close operation. I am using the following code:
public void expire(){
Calendar c = Calendar.getInstance();
int sDate = c.get(Calendar.YEAR);
int sMonth = c.get(Calendar.MONTH)+1;
int sDay = c.get(Calendar.DAY_OF_MONTH);
int sHour = c.get(Calendar.HOUR_OF_DAY);
int sMin = c.get(Calendar.MINUTE);
Toast.makeText(getApplicationContext(), ""+sDate+sMonth+sDay+"Hour is"+sHour, Toast.LENGTH_LONG).show();
if (sDay >=11){
System.exit(0);
}
}
I call expire(); on a button click to check, but all I get is a blank black screen for a few seconds and then the application works fine. Which I do not want.
For an activity to exit, you call finish()
.
call finish()
instead of System.exit(0);
and also make check on month too coz ur client will use the application for the first ten days of next month too :P :P :P
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With