title: Is there a way to execute a void only once at a certain time?
body: <p>I've got an activity with a recyclerview, and I want that recyclerview to show different listItems every time. That works, but I want this to run only once(at a certain hour eg. 00:00h) and not to run again every time that I get into the activity all the void that randomly decides which item to show on the recyclerview.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>public class Comida2 extends AppCompatActivity implements Adaptador2.OnRecipeListener {
      private RecyclerView recyclerView1;
      List&lt;Entidad2&gt; listItems;
      Adaptador2 adaptor;
      private Entidad2 entidad1,entidad2,entidad3;
      Button cambiarmenu;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          requestWindowFeature(Window.FEATURE_NO_TITLE);
          getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                  WindowManager.LayoutParams.FLAG_FULLSCREEN);
          setContentView(R.layout.activity_comida);
  
          cambiarmenu = (Button) findViewById(R.id.boton_cambiarmenu);
  
          recyclerView1 = findViewById(R.id.lv_1);
          LinearLayoutManager layoutManager = new LinearLayoutManager(this);
          layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
  
          recyclerView1.setLayoutManager(layoutManager);
  
          listItems = new ArrayList&lt;&gt;();
          entidad1 = new Entidad2(R.drawable.calabacines_3, "Solomillo a la plancha", " 10 min.", 4, 20);
          entidad2 = new Entidad2(R.drawable.patatas_deluxe_especiadas_70523_300_150, "Entrecot", " 15 min.", 2, 50);
          entidad3 = new Entidad2(R.drawable.tomate, "Hamburguesa", " 2 min.", 5, 100);
  
  
          listItems.add(entidad1);
          listItems.add(entidad2);
          listItems.add(entidad3);
  
          adaptor = new Adaptador2(listItems, this);
          recyclerView1.setAdapter(adaptor);
          adaptor.notifyDataSetChanged();
      }
  
  
      @Override
      public void OnRecipe(int priority) {
  
          if (priority == 20) {
              Intent in = new Intent(this, Solomillo.class);
              startActivity(in);
          }
          if (priority == 50) {
              Intent in = new Intent(this, Entrecot.class);
              startActivity(in);
          }
          if (priority == 100) {
              Intent in = new Intent(this, Hamburguesa.class);
              startActivity(in);
          }
      }
  
      public void pickEntidad(){
          final int random = new Random().nextInt(101);
  
          int priority1 = entidad1.getPriority();
          int priority2 = entidad2.getPriority();
          int priority3 = entidad3.getPriority();
  
  
          listItems.clear();
          if(random &lt; priority1){
  
              listItems.add(entidad1);
  
          }else if(random &lt; priority2){
  
              listItems.add(entidad2);
  
          }else if (random &lt;= priority3){
  
              listItems.add(entidad3);
  
          }
          adaptor.notifyDataSetChanged();
      }
  }
  </code></pre>
  
  <p>I've looked at some other posts but the problem is that I want all that process to run one time when I first get into the app and then I'd shut down the app. After that, get in the app and still not run the void. But it should run at a certain hour, 00:00h would be ok as an example.</p>
  
  <p>In addition, I'd like to add a button on a <strong>different</strong> activity which can run the void in <strong>this</strong> activity and therefore change what is randomly shown on the recyclerview.</p>