Note that there are some explanatory texts on larger screens.

plurals
  1. POContent Provider not working on Nexus family devices
    text
    copied!<p>I'm developing an app with a ContentProvider to offer some inner files (binary files). When I deploy it on a Samsung Galaxy S, SII, or any other, it works perfectly, buy when I try it on a Galaxy Nexus or Nexus S, it doesn't work!</p> <p>Scenario:</p> <p>My ContentProvider can be accessed with two URIs. Depending on this URI, the provider creates a DataCursor (extending CrossProcessCursor) or ModelCursor (extending CrossProcessCursos also). The fact is that, in Nexus family, I access the first cursor (DataCursor) to retrieve an identifier, and it works perfectly, but when accessing the second one, it always throws "OutOfBoundsException" when trying </p> <blockquote> <p>getBlob()</p> </blockquote> <p>method.</p> <p><strong>Provider</strong></p> <pre><code>@Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { Cursor cursor = null; // If the third app requieres DATA (phrase id, phrase string and phrase name) if(uri.toString().equalsIgnoreCase(ProviderConstants.DATA_URI.toString())) { // Build the DataHelper and the customized cursor DataHelper dataHelper = new DataHelper(getContext()); cursor = new DataCursor(dataHelper); } else if(uri.toString().equalsIgnoreCase(ProviderConstants.MODEL_URI.toString())) { // Let's take the model id from the selectionArgs... if (selectionArgs != null &amp;&amp; selectionArgs.length &gt; 0) { String modelId = selectionArgs[0]; // Get an instance to the persistent storage service... File file = FileManager.getDirectory(getContext(), modelId); FileSystemPersistentStorageService clientPersistentStorageService = new FileSystemPersistentStorageService(file); cursor = new ModelCursor(clientPersistentStorageService); } else { Log.e("ContentProvider", "Query without model id on selectionArgs"); } } return cursor; } </code></pre> <p>If you need some code or anything, just ask for it please!</p> <p>Thanks a lot.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload