title: Second Activity doesn't appear the second time
body: <p>I am working on an application with 2 activities. The secondActivity gives information to the main one and I have to access many times to SecondActivity. The problem is that the first time everything is ok but the second time the layout (of  secondActivity) doesn't appear. The touch event respond but I have a black screen(I can get the information share and I return to my mainActivity)...</p>
  
  <p>Here's my second Activity</p>
  
  <pre><code>public class SecondActivity extends ActionBarActivity {
  
         @Override
         protected void onCreate(Bundle savedInstanceState) {
               super.onCreate(savedInstanceState);
               setContentView(R.layout.second_layout);
         }
         @Override
  
         public boolean onTouchEvent(MotionEvent e) {
                      String setData="machin";
                      Intent person = new Intent();
                      Bundle backpack = new Bundle();
                      backpack.putString("answer", setData);
                      person.putExtras(backpack);
                      setResult(RESULT_OK, person);
                      finish();
  
                      return true;
          }
  
          @Override
          public boolean onCreateOptionsMenu(Menu menu) {
              getMenuInflater().inflate(R.menu.menu_main, menu);
                      return true;
           }
  }
  </code></pre>
  
  <p>Here how I call it</p>
  
  <pre><code>  Intent intent = new Intent(this, SecondActivity.class);
    startActivityForResult(intent, 0);
  </code></pre>
  
  <p>for the moment the data share is juste a String already set but it's just to test if my two activities can communicate.  </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I have change </p>
  
  <pre><code>public boolean onTouchEvent(MotionEvent e) {
                      String setData="machin";
                      Intent person = new Intent();
                      Bundle backpack = new Bundle();
                      backpack.putString("answer", setData);
                      person.putExtras(backpack);
                      setResult(RESULT_OK, person);
                      finish();
  
                      return true;
          }
  </code></pre>
  
  <p>into </p>
  
  <pre><code> public boolean onTouchEvent(MotionEvent e) {
         String setData="machin";
         Intent person = new Intent(this, MainActivity.class);
         person.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
         person.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         Bundle backpack = new Bundle();
         backpack.putString("answer", setData);
         person.putExtras(backpack);
         setResult(RESULT_OK, person);
  
         //finish();
         startActivity(person);
  
         return true;
      }
  </code></pre>
  
  <p>Now the Layout appears every time but I can't get the information share (I think it's because I don't call finish() but if you know an other way to do it ...)  </p>
  
  <p><strong>EDIT 2</strong> Thanks to Priya it's working</p>
  
  <p>my SecondActivity</p>
  
  <pre><code> public boolean onTouchEvent(MotionEvent e) {
                      String setData="machin";
                      Intent person = new Intent(this, MainActivity.class);
                      person.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                      person.putExtra("name",setData);
                      setResult(RESULT_OK, person);
  
                      startActivity(person);
  
                      return true;
     }
  </code></pre>
  
  <p>my MainActivity </p>
  
  <pre><code>protected void onResume(){
      Intent intent = getIntent();
      if(intent!=null){
          String name = intent.getStringExtra("name");
          Log.d("fdjsfdjksf","fdjskhfkdjshf"+name);
      }
  }
  </code></pre>