title: Why does Load image work on emulator but not on s4?
body: <p>I'm trying to get an image to load onto my app in an imageview. However whenever I try it on my S4 (running 4.4.2) once I tap on the image I want to load. it says 'Unfortunately, E-textHome has stopped.'. But when I try the app on my emulator, which is a Nexus7 (running 4.1.3) It works perfectly fine. So I was wondering what have I done wrong and how do I make it work on my s4? Thanks!</p>
  
  <p>Code:-</p>
  
  <pre><code>public class EncryptImg extends ActionBarActivity implements OnClickListener{
  
      private static int LOAD_IMAGE_RESULTS = 1;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          setContentView(R.layout.encryptimg);
  
          Button galleryBrowse =  (Button) findViewById(R.id.browseGallerybtn1);
          galleryBrowse.setOnClickListener(this); /*Set OnClickListener for to listen for the galerryBrowse button*/
  
      }
      @Override
      public void onClick(View v) {
          // TODO Auto-generated method stub
          if(v.getId() == R.id.browseGallerybtn1){
              Intent loadImgIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); 
              startActivityForResult(loadImgIntent, LOAD_IMAGE_RESULTS);
          }
      }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          ImageView imgEncrypt = (ImageView) findViewById(R.id.encryptImgView);
  
          // http://www.itcuties.com/android/pick-image-from-gallery/.
  
          if (requestCode == LOAD_IMAGE_RESULTS &amp;&amp; resultCode == RESULT_OK &amp;&amp; data != null) {
              // Let's read picked image data - its URI
              Uri pickedImage = data.getData();
              // Let's read picked image path using content resolver
              String[] filePath = { MediaStore.Images.Media.DATA };
              Cursor cursor = getContentResolver().query(pickedImage, filePath, null, null, null);
              cursor.moveToFirst();
              String imagePath = cursor.getString(cursor.getColumnIndex(filePath[0]));
  
              // Now we need to set the GUI ImageView data with data read from the picked file.
              imgEncrypt.setImageBitmap(BitmapFactory.decodeFile(imagePath));
  
              // At the end remember to close the cursor or you will end with the RuntimeException!
              cursor.close();
          }
      }
  
  }
  </code></pre>
  
  <p>XML file:-</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent" &gt;
  
      &lt;Button
          android:id="@+id/browseGallerybtn1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_alignParentTop="true"
          android:layout_marginLeft="19dp"
          android:layout_marginTop="20dp"
          android:text="Browse Gallery" /&gt;
  
      &lt;ImageView
          android:id="@+id/encryptImgView"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerHorizontal="true"
          android:layout_centerVertical="true"
          android:src="@drawable/ic_launcher" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>