1.Intent intent = new Intent(this, MainMenu.class); 
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
startActivity(intent);

上述情况是指 如果你有多个activivty,如果俺back建要一丛丛返回,上面的实现了只返回到主界面

 

2.

private static final int MEDIA_IMAGE_REQUEST_CODE = 203948; // This can be any unique number you like 
 
Intent getImageFromGalleryIntent =  
  new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.INTERNAL_CONTENT_URI); 
startActivityForResult(getImageFromGalleryIntent, MEDIA_IMAGE_REQUEST_CODE); 
protected final void onActivityResult(final int requestCode, final int resultCode, final Intent i) { 
  super.onActivityResult(requestCode, resultCode, i); 
  if(resultCode == RESULT_OK) { 
    switch(requestCode) { 
      case MEDIA_IMAGE_REQUEST_CODE: 
 
        // Get the chosen images Uri 
        Uri imageUri = i.getData(); 
 
        // Load the bitmap data from the Uri  
        // It is probably best to do this in an AsyncTask to avoid clogging up the Main Thread 
      break; 
    } 
  }