title: Media files information not updating on ContentResolver.query
body: <p>I am writing an android app that allows me to update media files.
  I have an AsyncTask that (among other things) scans the device for media files.</p>
  
  <p>The code below is the method used to get all the media files and create a list of FileInfo (my class, holding basic meta data of files).</p>
  
  <p>The problem is that the data received from the <code>Cr().query</code> is always the same and not bringing the latest updates.</p>
  
  <p>I have looked at <a href="https://stackoverflow.com/questions/15338375/android-contentresolver-query-always-returns-same-data">this similar issue</a> but you can see that my code does the solution recommended there, yet I still get the old data rather than the refreshed.</p>
  
  <p>Took me a while to figure out this is the problem, but I now see it clearly in the output of the log statement <code>Log.d("scanLocalFiles", "" + fileInfos.size() + "|" + data + ":" + size );</code>
  that a file that I know that has been changed, still appears with its original size.
  (I know it has been changed because I see the updated one on ES-FileExplorer...)</p>
  
  <p>Any suggestion of what might be going on?</p>
  
  <p>Thanks.</p>
  
  <p>Code below:</p>
  
  <pre><code>private List&lt;FileInfo&gt; scanLocalFiles(Uri... uris)
  {
      List&lt;FileInfo&gt; fileInfos = new ArrayList&lt;FileInfo&gt;();
      String[] projection = new String[]{
              MediaStore.MediaColumns._ID,
              MediaStore.MediaColumns.DATA,
              MediaStore.MediaColumns.SIZE,
              MediaStore.MediaColumns.MIME_TYPE
      };
      for (int u=0; u &lt; uris.length; u++)
      {
          Uri uri = uris[u];
  
          //Uri images = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
  
          Cursor cur = Cr().query(uri,
                  projection, // Which columns to return
                  "",         // Which rows to return (all rows)
                  null,       // Selection arguments (none)
                  ""          // Ordering
                  );
  
          if(cur!=null &amp;&amp; cur.moveToFirst())
          {
              try
              {
                  int idColumn = cur.getColumnIndex(projection[0]);
                  int dataColumn = cur.getColumnIndex(projection[1]);
                  int sizeColumn = cur.getColumnIndex(projection[2]);
                  int mimeColumn = cur.getColumnIndex(projection[3]);
                  do
                  {
                      Uri id = Uri.withAppendedPath(uri, cur.getString(idColumn));
                      String data = cur.getString(dataColumn);
                      long size = cur.getLong(sizeColumn);
                      String mime = cur.getString(mimeColumn);
                      Log.d("scanLocalFiles", "" + fileInfos.size() + "|" + data + ":" + size );
                      fileInfos.add(new FileInfo(id, data, size, mime));
  
                  } while (cur.moveToNext());
              }
              catch (Exception ex)
              {
                  ex.printStackTrace();
              }
              finally
              {
  
                  cur.close();
              }
          }
      }
      return fileInfos;
  }
  </code></pre>