title: How does it work, that when I always open the app, it run the method and not only when I click on run?
body: <p>I want a random number every time I open the app and not only when I press &quot;Run&quot;. How do I do that?
  If I close the App on the Emulator/on my Samsung and opened the App again, always the same quote is here.
  When I cklick the (re)run button in Android Studio only then it runs the Methode <code>setQuote()</code> again.</p>
  <p>What can I do, that this method always run when i open my app?</p>
  <p>This is my code:</p>
  <pre><code>public class MainActivity extends Activity {
  
  @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
  @Override`enter code here`
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      setQuote();
  }
  
  
  @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
  public void setQuote(){
  
      List&lt;String&gt; listQuotes= new ArrayList&lt;&gt;();
      listQuotes.add(&quot;Quote 1&quot;);
      listQuotes.add(&quot;Quote 2&quot;);
      listQuotes.add(&quot;Quote 3&quot;);
      listQuotes.add(&quot;Quote 4&quot;);
  
      int random = ThreadLocalRandom.current().nextInt(0, listQuotes.size()+ 1);
      
      String quote = listQuotes.get(random);
       
    
      TextView textview = findViewById(R.id.textView5);
      textview.setText(quote);
      textview.setGravity(Gravity.CENTER_HORIZONTAL);
  
  }
  </code></pre>