Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8978203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:33:13+00:00 2026-06-15T19:33:13+00:00

I am installing this application on the said tablet and I intend to supply

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:33:14+00:00Added an answer on June 15, 2026 at 7:33 pm

    Using finish() seemed to be working on the emulator after I called expire(); from the onCreate and not on button Click. However using System.exit(0) on a real device did help while as finish() did not.

    System.exit() (In pure and core Java) can be used to run shutdown hooks before the program quits. This is a convenient way to handle shutdown in bigger programs, where all parts of the program can’t (and shouldn’t) be aware of each other. Then, if someone wants to quit, he can simply call System.exit(), and the shutdown hooks (if properly set up) take care of doing all necessary shutdown ceremonies such as closing files, releasing resources.

    While as in case of finish() The method that called finish() will run to completion. The finish() operation will not even begin until you return control to Android.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My client want to use Installing apps wirelessly feature. Using this he can download
I have created the setup of a Windows Forms application. After installing this setup
I have a simple WPF application that uses ClickOnce to handle installing. Within this
After installing .NET 4.0, I am now getting an exception on this statement: if
This issue has come up three times in our environment. After installing the ClickOnce
I want to force users to like a Facebook page before installing an application,
I tried to start Visual Studio and it said: This application has failed to
I have a .Net application. I want this application to send an email to
I have developed a WPF application in C# 4.0. This application is installing some
Im installing phpancake, there is a folder there shema like this application/ install/ library/

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.