views:

7

answers:

0

I have an activity which uses the Android search and the auto search-suggestions capability.

The thumbnails I am using in my activity are all stored on the SD card (there's a lot of them) and are all in MDPI resolution.

When using them in my activity this is fine as I can account for this and scale appropriately, however in the search suggestions view it seems the thumbnail is assumed to be at the current DPI, and thus the thumbnails look small on HDPI devices.

I am retrieving the thumbnails for the search suggestions view using a custom ContentProvider and overriding the openFile method - however I can't see how this gives me any control over setting the DPI as it just returns a generic ParcelFileDescriptor.

Is it possible to use the ParcelFileDescriptor to inform the search suggestions view of the DPI? Or is there another possible method? I cannot control it directly myself as the Android framework handles the mapping of data to the auto-suggestions view.

My openFile method looks like:

public ParcelFileDescriptor openFile( Uri uri, String mode ) {
        String deletePackage = "content://" + PACKAGE_NAME + "/";
        String url = uri.toString();
        String filePath = url.substring(deletePackage.length());
        Log.d("AssetsContentProvider", "openFile: " + filePath);
        File file = new File( filePath );

        ParcelFileDescriptor parcel = null;
        try {
            parcel = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
        } catch (FileNotFoundException e) {
            Log.e( "AssetsContentProvider", "Error finding: " + file.getPath() + "\n" + e.toString() );
        }

        return parcel;
}

This seems to be the only place I have any control over the file between the auto-suggest manager requesting it and it being displayed.