title: SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider ur requires android.permission.READ_EXTERNAL_STORAGE
body: <p>i have an activity that having a browser button and then an imageview which want users to see what they upload , but everytime that going to choose what image want to "upload" i am taking error "Not responding" ... although i have put permissions in manifest...</p>
  
  <p>error log by (logcat)</p>
  
  <blockquote>
    <p>12-10 03:55:39.459 5357-5357/com.holomedia.holomedia E/AndroidRuntime:
    FATAL EXCEPTION: main
                                                                           Process: com.holomedia.holomedia, PID: 5357
                                                                           java.lang.RuntimeException: Failure delivering result
    ResultInfo{who=null, request=1, result=-1, data=Intent {
    dat=content://media/external/images/media/39 }} to activity
    {com.holomedia.holomedia/com.holomedia.holomedia.Add_video}:
    java.lang.SecurityException: Permission Denial: reading
    com.android.providers.media.MediaProvider uri
    content://media/external/images/media/39 from pid=5357, uid=10060
    requires android.permission.READ_EXTERNAL_STORAGE, or
    grantUriPermission()
                                                                               at android.app.ActivityThread.deliverResults(ActivityThread.java:3699)
                                                                               at
    android.app.ActivityThread.handleSendResult(ActivityThread.java:3742)
                                                                               at android.app.ActivityThread.-wrap16(ActivityThread.java)
                                                                               at
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1393)
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                               at android.os.Looper.loop(Looper.java:148)
                                                                               at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                               at java.lang.reflect.Method.invoke(Native Method)
                                                                               at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                            Caused by: java.lang.SecurityException: Permission Denial: reading
    com.android.providers.media.MediaProvider uri
    content://media/external/images/media/39 from pid=5357, uid=10060
    requires android.permission.READ_EXTERNAL_STORAGE, or
    grantUriPermission()
                                                                               at android.os.Parcel.readException(Parcel.java:1599)
                                                                               at
    android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
                                                                               at
    android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
                                                                               at
    android.content.ContentProviderProxy.query(ContentProviderNative.java:421)
                                                                               at android.content.ContentResolver.query(ContentResolver.java:491)
                                                                               at android.content.ContentResolver.query(ContentResolver.java:434)
                                                                               at
    com.holomedia.holomedia.Add_video.onActivityResult(Add_video.java:48)
                                                                               at android.app.Activity.dispatchActivityResult(Activity.java:6428)
                                                                               at android.app.ActivityThread.deliverResults(ActivityThread.java:3695)
                                                                               at
    android.app.ActivityThread.handleSendResult(ActivityThread.java:3742) 
                                                                               at android.app.ActivityThread.-wrap16(ActivityThread.java) 
                                                                               at
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1393) 
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102)</p>
  </blockquote>
  
  <pre><code>                                                                       at android.os.Looper.loop(Looper.java:148) 
                                                                         at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                         at java.lang.reflect.Method.invoke(Native Method) 
                                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
  </code></pre>
  
  <p>... my xml code:</p>
  
  <pre><code>"&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"&gt;
  
      &lt;ImageView
          android:id="@+id/imgView"
          android:layout_width="fill_parent"
          android:layout_height="462dp"
          android:layout_weight="1"&gt;&lt;/ImageView&gt;
      &lt;Button
          android:id="@+id/buttonLoadPicture"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_weight="0"
          android:text="Load Picture"
          android:layout_gravity="center"&gt;&lt;/Button&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>my .java code </p>
  
  <pre><code>package com.holomedia.holomedia;
  import android.content.Intent;
  import android.database.Cursor;
  import android.graphics.BitmapFactory;
  import android.net.Uri;
  import android.os.Bundle;
  import android.provider.MediaStore;
  import android.support.v7.app.AppCompatActivity;
  import android.view.View;
  import android.widget.Button;
  import android.widget.ImageView;
  
  public class Add_video extends AppCompatActivity {
  
  
      private static int RESULT_LOAD_IMAGE = 1;
  
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_add_video);
  
          Button buttonLoadImage = (Button) findViewById(R.id.buttonLoadPicture);
          buttonLoadImage.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View arg0) {
  
                  Intent i = new Intent(
                          Intent.ACTION_PICK,
                          android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
  
                  startActivityForResult(i, RESULT_LOAD_IMAGE);
              }
          });
      }
  
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
  
          if (requestCode == RESULT_LOAD_IMAGE &amp;&amp; resultCode == RESULT_OK &amp;&amp; null != data) {
              Uri selectedImage = data.getData();
              String[] filePathColumn = { MediaStore.Images.Media.DATA };
  
              Cursor cursor = getContentResolver().query(selectedImage,
                      filePathColumn, null, null, null);
              cursor.moveToFirst();
  
              int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
              String picturePath = cursor.getString(columnIndex);
              cursor.close();
  
              ImageView imageView = (ImageView) findViewById(R.id.imgView);
              imageView.setImageBitmap(BitmapFactory.decodeFile(picturePath));
  
          }
  
  
      }
  }
  </code></pre>
  
  <p>mymanifest : </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.holomedia.holomedia"&gt;
  
      &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
      &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"&gt;
          &lt;activity android:name=".activity_launch"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".MainActivity"
              android:label="@string/title_activity_main"
              android:theme="@style/AppTheme.NoActionBar"
              android:uiOptions="splitActionBarWhenNarrow" /&gt;
          &lt;activity android:name=".Add_video" /&gt;
          &lt;activity android:name=".VideoView" /&gt;
          &lt;activity android:name=".PlayVideo"&gt;&lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>