code: public static int checkMediaState(){
  		int mediastate = UNAVAILABLE;
  		String state = Environment.getExternalStorageState();
  
  		if (Environment.MEDIA_MOUNTED.equals(state)) {
  		    // We can read and write the media
  		    mediastate = READ_WRITE;
  		} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
  		    // We can only read the media
  		    mediastate = READ_ONLY;
  		} else {
  		    // Something else is wrong. It may2 nor write
  		    mediastate = UNAVAILABLE;
  		}
  		
  		return mediastate;
  	}
docs: Check the state of the external media (i.e. SDCard) on whether
  it is read/write, read only, or unavailable
  
  @return 	the corresponding constant to the media state(RW/RO/Unavailable)