title: Permission Denial when trying to access contacts in Android
body: <p>I am trying to access the contacts on the device and later display them in a list, however when I try to access them with a cursor, I get an error that I'm missing permissions for READ_CONTACTS but I have already gave permissions in my AndroidManifest.xml</p>
  
  <p>Code where I access Contacts:</p>
  
  <pre><code>public void setupCursor() {
      Cursor cursor = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null);
  
      while (cursor.moveToNext()) {
          String name = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
          String number = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
          Toast.makeText(this, name + ": " + number, Toast.LENGTH_SHORT).show();
      }
      cursor.close();
  }
  </code></pre>
  
  <p>AndroidManifest.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="io.github.brady131313.textback" &gt;
  
  &lt;uses-sdk android:minSdkVersion="15" android:targetSdkVersion="21"/&gt;
  
  &lt;uses-permission android:name="ANDROID.PERMISSION.READ_CONTACTS"/&gt;
  
  &lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:theme="@style/AppTheme" &gt;
      &lt;activity
          android:name=".ActivityMainSettings"
          android:label="@string/app_name" &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=".ActivityContactSelect"
          android:label="Select Contacts"&gt;
      &lt;/activity&gt;
  
  &lt;/application&gt;
  
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>Error Log</p>
  
  <pre><code>05-17 17:12:41.544  20202-20202/io.github.brady131313.textback E/AndroidRuntime﹕ FATAL EXCEPTION: main
      Process: io.github.brady131313.textback, PID: 20202
      java.lang.RuntimeException: Unable to start activity ComponentInfo{io.github.brady131313.textback/io.github.brady131313.textback.ActivityContactSelect}: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{14c069a9 20202:io.github.brady131313.textback/u0a90} (pid=20202, uid=10090) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2661)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
              at android.app.ActivityThread.access$900(ActivityThread.java:172)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:145)
              at android.app.ActivityThread.main(ActivityThread.java:5835)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:372)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
       Caused by: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{14c069a9 20202:io.github.brady131313.textback/u0a90} (pid=20202, uid=10090) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS
              at android.os.Parcel.readException(Parcel.java:1540)
              at android.os.Parcel.readException(Parcel.java:1493)
              at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:3582)
              at android.app.ActivityThread.acquireProvider(ActivityThread.java:5081)
              at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2926)
              at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1452)
              at android.content.ContentResolver.query(ContentResolver.java:468)
              at android.content.ContentResolver.query(ContentResolver.java:428)
              at io.github.brady131313.textback.ActivityContactSelect.setupCursor(ActivityContactSelect.java:46)
              at io.github.brady131313.textback.ActivityContactSelect.onCreate(ActivityContactSelect.java:32)
              at android.app.Activity.performCreate(Activity.java:6221)
              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2614)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
              at android.app.ActivityThread.access$900(ActivityThread.java:172)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:145)
              at android.app.ActivityThread.main(ActivityThread.java:5835)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:372)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1388)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1183)
  </code></pre>
  
  <p>Any help will be appreciated!</p>