title: automatically go to the result page after pressing save button
body: <p>how do I make it automatically go to the result page after I press the save button? my application seems to stay on the same page after I press the save button. attached below is the source code</p>
  
  <p>DetailForm.Java</p>
  
  <pre><code>public class DetailForm extends Activity {
  EditText name = null;
  EditText address = null;
  EditText telephone = null;
  EditText details = null;
  NameCardHelper helper = null;
  String namecardId = null;
  TextView location = null;
  LocationManager locMgr = null;
  double latitude = 0.0d;
  double longitude = 0.0d;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.detail_form);
  
      locMgr = (LocationManager) getSystemService(LOCATION_SERVICE);
  
      helper = new NameCardHelper(this);
  
      name = (EditText) findViewById(R.id.name);
      address = (EditText) findViewById(R.id.address);
      telephone = (EditText) findViewById(R.id.telephone);
      details = (EditText) findViewById(R.id.details);
      location = (TextView) findViewById(R.id.location);
  
      namecardId = getIntent().getStringExtra(NameCardList.ID_EXTRA);
      if (namecardId != null) {
          load();
      }
  }
  
  @Override
  public void onPause() {
      save();
      super.onPause();
  }
  
  @Override
  public void onDestroy() {
      helper.close();
      locMgr.removeUpdates(onLocationChange);
      super.onDestroy();
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      new MenuInflater(this).inflate(R.menu.details_option, menu);
      return (super.onCreateOptionsMenu(menu));
  }
  
  @Override
  public boolean onPrepareOptionsMenu(Menu menu) {
      if (namecardId == null) {
          menu.findItem(R.id.location).setEnabled(false);
          menu.findItem(R.id.map).setEnabled(false);
      }
      return (super.onPrepareOptionsMenu(menu));
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      if (item.getItemId() == R.id.location) {
  
          locMgr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
                  onLocationChange);
          return (true);
  
          } else if (item.getItemId() == R.id.map) {
              Intent i = new Intent(this, NameCardMap.class);
              i.putExtra(NameCardMap.EXTRA_LATITUDE, latitude);
              i.putExtra(NameCardMap.EXTRA_LONGITUDE, longitude);
              i.putExtra(NameCardMap.EXTRA_NAME, name.getText().toString());
              startActivity(i);
              return (true);
          } else if (item.getItemId() == R.id.call) {
               Intent i = new Intent(Intent.ACTION_CALL);
  
                  String p = "tel:" + telephone.getText();
                  i.setData(Uri.parse(p));
                  startActivity(i);
          } else if (item.getItemId() == R.id.sms) {
  
              Intent smsIntent = new Intent(Intent.ACTION_SENDTO);
              smsIntent.addCategory(Intent.CATEGORY_DEFAULT);
              smsIntent.setType("vnd.android-dir/mms-sms");
              smsIntent.setData(Uri.parse("sms:" + telephone.getText()));
              startActivity(smsIntent);
          } else if (item.getItemId() == R.id.delete) {
  
              helper.delete(namecardId);
  
              startActivity(new Intent(this, NameCardList.class));
              return (true);
          }
      return true;
          }
  
  private boolean isNetworkAvailable() {
      ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
  
      NetworkInfo info = cm.getActiveNetworkInfo();
      return (info != null);
  }
  
  private void load() {
      Cursor c = helper.getById(namecardId);
      c.moveToFirst();
  
      name.setText(helper.getName(c));
      address.setText(helper.getAddress(c));
      telephone.setText(helper.getTelephone(c));
      details.setText(helper.getDetails(c));
  
      latitude = helper.getLatitude(c);
      longitude = helper.getLongitude(c);
      location.setText(String.valueOf(latitude) + ", "
              + String.valueOf(longitude));
  
      c.close();
  }
  
  private void save() {
      if (name.getText().toString().length() &gt; 0) {
  
          if (namecardId == null) {
              helper.insert(name.getText().toString(), address.getText()
                      .toString(), telephone.getText().toString(),
                      details.getText().toString());
          } else {
              helper.update(namecardId, name.getText().toString(), address
                      .getText().toString(), telephone.getText().toString(),
                      details.getText().toString());
          }
      }
  
  }
  
  LocationListener onLocationChange = new LocationListener() {
      public void onLocationChanged(Location fix) {
          helper.updateLocation(namecardId, fix.getLatitude(),
                  fix.getLongitude());
          location.setText(String.valueOf(fix.getLatitude()) + ", "
                  + String.valueOf(fix.getLongitude()));
          locMgr.removeUpdates(onLocationChange);
  
          Toast.makeText(DetailForm.this, "Location saved", Toast.LENGTH_LONG)
                  .show();
      }
  
      public void onProviderDisabled(String provider) {
          // required for interface, not used
      }
  
      public void onProviderEnabled(String provider) {
          // required for interface, not used
      }
  
      public void onStatusChanged(String provider, int status, Bundle extras) {
          // required for interface, not used
      }
  };
  }
  </code></pre>