title: How to write code that changes the value of a variable automatically every week?
body: <p>I am writing an app that tracks an exercise routine and multiplies the time or reps for the exercises by 10% every week. As I'm a total beginner to Android Studio and Java, I'm having trouble understanding how to write code that executes every time I launch the app and how to write code that only executes once on the first launch.</p>
  
  <p>Here's my code, I have an Exercises class, and in the MainActivity I wrote</p>
  
  <pre><code>Exercises stretch = new Exercises("Stretch", 360);
  
  Calendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
  int day = calendar.get(Calendar.DAY_OF_YEAR); //execute this every day
  int compare_day = day;
  if(day-compare_day&gt;=7){
  warmup.setTime((int) (warmup.getTime()*1.1));
  int compare_day = day;
  }
  </code></pre>
  
  <p>How do I write the code that would update the <strong>day</strong> variable every day, but not the <strong>compare_day</strong> variable? And is there a better solution, one that would do it automatically, without having to open the app every day?</p>