Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid thumbnail list
    primarykey
    data
    text
    <p>For my flash app i needed to create a "native extension", which is a native android Java call. This extension builds a string which consist of all image files and their corresponding thumbnails and returns it to Flash. </p> <p>I'm not a Java programmer and this is my first attempt on writing android code. So after 2 days of digging I came up with this:</p> <pre><code>public String getThumbPaths(Uri uri, ThumbContext ctx) { String out = ""; Cursor cursor = MediaStore.Images.Thumbnails.queryMiniThumbnails(ctx .getActivity().getContentResolver(), uri, MediaStore.Images.Thumbnails.MINI_KIND, null); for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { String imageId = cursor.getString(cursor .getColumnIndex(Thumbnails.IMAGE_ID)); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor images = ctx.getActivity().managedQuery( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, filePathColumn, MediaStore.Images.Media._ID + "=?", new String[] { imageId }, null); String filePath = ""; if (images != null &amp;&amp; images.moveToFirst()) { filePath = images.getString(images.getColumnIndex(filePathColumn[0])); } out += cursor.getString(1) + ";" + filePath+";"; } return out; } </code></pre> <p>and the call</p> <pre><code>ThumbContext ctx = (ThumbContext) context; Uri uri = MediaStore.Images.Thumbnails.getContentUri("external"); // content://media/external/images/thumbnails String paths = getThumbPaths(uri, ctx); </code></pre> <p>Everything works well, except for the speed. I don't know if this happens because of Flash-Java-Flash calls or the piece of code above, which i can't check because the compilation happens inside the Flash. </p> <p><strong>So my question is: can i speed up this code? Maybe do this without second cursor inside the "for" loop?</strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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