いくつかの内部ファイル(バイナリファイル)を提供するために、ContentProviderを使用してアプリを開発しています。サムスンギャラクシーS、SII、またはその他に展開すると、完全に機能します。ギャラクシーネクサスまたはネクサスSで試してみると、機能しません。
シナリオ:
私のContentProviderには2つのURIでアクセスできます。このURIに応じて、プロバイダーはDataCursor(CrossProcessCursorを拡張)またはModelCursor(CrossProcessCursosも拡張)を作成します。実際、Nexusファミリでは、最初のカーソル(DataCursor)にアクセスして識別子を取得します。これは完全に機能しますが、2番目のカーソルにアクセスすると、試行時に常に「OutOfBoundsException」がスローされます。
getBlob()
方法。
プロバイダー
@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 && selectionArgs.length > 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;
}
コードなどが必要な場合は、リクエストしてください。
どうもありがとう。