title: How to go previous Activity by using back button
body: <p>I have created two activity i.e Activity A &amp; Activity B ,if i clicked Next Button i.e  in Activity A going to Activity B properly But when i click on back button i want to go from Activity B to Activity A  and page swipe from left side to right side and on click next page swipe right to left,</p>
  
  <p>here is my code </p>
  
  <pre><code>public void onBackPressed() {
      Intent intent = new Intent(ActivityB.this, Activity.class);
      startActivity(intent);
    finish(); 
  </code></pre>