title: Returning back to main activity from gameover screen
body: <p>Hi so even though I have seen a couple of topics about linking activities or returning I can not get my return back to activity to work. I abit of back ground the the app when the user gets an answer wrong or runs out of time it goes to game over taking the score across with it and displaying it on the game over, here's the working code for that if it helps solve my issue:
  Main Class:</p>
  
  <pre><code> public void fail(){
          {
              Intent myIntent = new Intent(MainActivity.this,gameover.class);
              myIntent.putExtra("number", score);
  
  
              MainActivity.this.startActivity(myIntent);
              finish();
  
          }
  </code></pre>
  
  <p>gameover class:</p>
  
  <pre><code>  public void onCreate(Bundle savedInstanceState) {         
           super.onCreate(savedInstanceState);    
  setContentView(R.layout.gameover);
  re_run = (Button) findViewById(R.id.retry);
          EndScore = (TextView) findViewById(R.id.show);
          int getVal;
          getVal = getIntent().getExtras().getInt("number");
          String s = String.valueOf( getVal );
          EndScore.setText(s);     
    }
  </code></pre>
  
  <p>Now the reason I shared the above working code because I have the feeling the intent that takes the user and score to the gameover screen, is messing with the retry/return code as shown below:</p>
  
  <pre><code>private void setButtonOnClickListeners(){
            re_run.setOnClickListener(new OnClickListener(){
              @Override
              public void onClick(View v) {
                  Intent retry = new Intent(getApplicationContext(),
                          MainActivity.class);
                  startActivity(retry);
  
              }
          });
  }
  </code></pre>
  
  <p>From what I can find from those topics these seems to be the correct method. but when the code is run the re_run button does nothing. Any help?</p>