How to performantly load images from android device?

I’m making a daydream app that needs to load thumbnails of images found on the device. I need them to be displayed in the UI so I tried creating sprites and Texture2Ds using WWW and coroutines but it ran really slowly and crashed if I loaded more than 30 images. What is the correct way to do this?

I am now using the native android ThumbnailUtils to create a thumbnail images but if I stream them back into unity as a byte arrays I can’t load them without it being slow again. I haven’t had any luck trying to apply the textures outside of unity. Can someone tell me what’s wrong with this?

Here’s my unity…

AndroidJavaObject ajo = new AndroidJavaObject("com.t2.unityplugin.CreateThumbnail");
ajo.Call("LoadThumbnail", path, (int)newTexture.GetNativeTexturePtr());

And here’s my Java…

public void LoadThumbnail(String path, int pointer){
        String newPath = path.replace("file://","");
        Bitmap bitmap = BitmapFactory.decodeFile(newPath);
        Bitmap thumb = ThumbnailUtils.extractThumbnail(bitmap, 260, 260);

        // Bind texture and then copy data
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, pointer);
        GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, thumb, 0);
    }

I’ve been stuck on this for days. Any help would be greatly appreciated.

Pasting the generated thumbnail into a texture that is provided by unity seems to be the most performant option.
I have done similar stuff on iOS to render PDF on the iOS PDF render and paste them into unity texture in a native plugin.
That were relatively big images on a iPAd 1 so this should run fine. (I can not test your current java example et the moment)