title: How to change an ImageView visibility from a different activity after pressing a button?
body: <p>I'm developing a simple android game divided into levels. I want a check icon (ImageView) to appear next to a level button (on level select menu) when that level is completed.
  A level is completed after pressing a button, as follows (InsideLevelActivity):</p>
  
  <pre><code>    final EditText level1editText=(EditText)findViewById(R.id.level1editText);        
      Button level1completeButton=(Button)findViewById(R.id.level1completeButton);
  
      level1completeButton.setOnClickListener(new View.OnClickListener()
          public void onClick(View v)
          {
              final String edittext=level1editText.getText().toString();
  
              if(edittext.trim().equals("Complete level"))
               {   
  
                {
                  Intent visible1 = new Intent();
                  visible1.putExtra("iconvisible",0);
                  startActivity(visible1);
  
                      {
                        LayoutInflater inflater = getLayoutInflater();
                        View view = inflater.inflate(R.layout.activity_level1completed,
                        (ViewGroup) findViewById(R.id.img11_toast));
  
                  Toast toast = new Toast(Level1Activity.this);
                  toast.setView(view);
                  toast.show();
  
                  { onBackPressed(); {
  
                          return;
                      }
  
  
              }   
  
              }
              else
              {
                      Toast.makeText(Level1Activity.this,
                      "Type Complete level.", Toast.LENGTH_LONG).show();
              }
  </code></pre>
  
  <p>And then returns to level select menu activity. I'm trying to  retrieve data this way (LevelMenuActivity):</p>
  
  <pre><code>ImageView logocheckicon1=(ImageView)findViewById(R.id.logocheckicon1);
  logocheckicon1.setVisibility(View.GONE);
  
  Intent visible1 = getIntent();
  int state = Integer.parseInt(visible1.getExtras().get("iconvisible").toString());
  complete1.setVisibility(iconvisible);
  </code></pre>
  
  <p>I've tried many approaches for the last couple of days, including <a href="https://stackoverflow.com/questions/2091465/how-do-i-pass-data-between-activities-in-android">this one (how to pass data between two activities)</a>. I've even tried to make the check icon (ImageView) invisible, and making it visible again <a href="https://stackoverflow.com/questions/8896936/how-can-i-make-a-button-visible-in-one-activity-when-clicking-a-radiobutton-in-a">this way</a>.</p>
  
  <p>Also, the same check icon will appear next to every completed level. Is it possible to acomplish this with only one ImageView (without creating 10 different IDs of the same drawable)?</p>
  
  <p>Thank you in advance.</p>
  
  <p>EDIT:
  I apologize if i wasn't clear enough. I tought there was some way to change the visibility of an image located, for instance, on MainActivity with an intent inside the button on another activity.
  Thank you for your answers.</p>
  
  <p>EDIT2: Added the code of another unsuccessful try.</p>