title: Pressing back button from one activity refreshes previous activity in stack
body: <p>On pressing back button from child activity parent activity displays for a second and refreshes itself. </p>
  
  <p>In child activity I have this code in java file</p>
  
  <pre><code>@Override
  public void onBackPressed()
  {
  
      Intent moveback =
              new Intent(ClassActivityEdit.this, ClassActivity.class);
      startActivity(moveback);
      finish();
  }
  </code></pre>
  
  <p>ClassActivityEdit is child class. In manifest file code is as follows</p>
  
  <pre><code>&lt;activity android:name=".ClassActivity"
          android:label="Class Activity"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="com.teamtreehouse.oslist.ClassActivity" /&gt;
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  
      &lt;activity android:name=".ClassActivityEdit"
          android:label="Class Activity"
          android:noHistory="true"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="com.teamtreehouse.oslist.ClassActivityEdit" /&gt;
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  </code></pre>
  
  <p>On back button I just want the ClassActivity layout to be displayed without it being refreshed.</p>
  
  <p><strong>Edit:</strong> 
  <code>ClassActivityEdit</code> doesnt extend <code>ClassActivity</code>. Its just that some button press in <code>ClassActivity</code> will result in opening <code>ClassActivityEdit</code>.</p>
  
  <p><strong>Edit2</strong></p>
  
  <p>the below code in <code>ClassActivity</code> starts <code>ClassActivityEdit</code></p>
  
  <pre><code>public void editListener(View v) {
          Intent addNewClass =
                  new Intent(ClassActivity.this, ClassActivityEdit.class);
          RelativeLayout buttonTableRow = (RelativeLayout) v.getParent();
          TextView getCourseID = (TextView) buttonTableRow.findViewById(R.id.courseNumberActivity);
          String courseIDString = getCourseID.getText().toString();
          Bundle bundle = new Bundle();
  
          //Add your data to bundle
          bundle.putString("CourseIDString", courseIDString);
  
          addNewClass.putExtras(bundle);
          startActivity(addNewClass);
  }
  </code></pre>
  
  <hr>
  
  <p>Edit 3: I also have a Landing (MAIN) activity which flashes for a second. On pressing back button from <code>ClassActivityEdit</code> activity Landing activity flashes again and then the <code>ClassActivity</code> activity loads. Finding it a bit tricky to solve.</p>
  
  <pre><code>public class LoadingPage extends ActionBarActivity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.loading_page);
      new Handler().postDelayed(new Runnable() {
          @Override
          public void run() {
              Intent mainIntent = new Intent(LoadingPage.this, ClassActivity.class);
              startActivity(mainIntent);
          }
      }, 1000);
  }
  </code></pre>
  
  <p>}</p>