Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8832771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:36:45+00:00 2026-06-14T08:36:45+00:00

For my flash app i needed to create a native extension, which is a

  • 0

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.

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:

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 && images.moveToFirst()) {
            filePath = images.getString(images.getColumnIndex(filePathColumn[0]));
        }

        out += cursor.getString(1) + ";" + filePath+";";

    }

    return out;
}

and the call

ThumbContext ctx = (ThumbContext) context;
Uri uri = MediaStore.Images.Thumbnails.getContentUri("external"); // content://media/external/images/thumbnails
String paths = getThumbPaths(uri, ctx);

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.

So my question is: can i speed up this code? Maybe do this without second cursor inside the “for” loop?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T08:36:46+00:00Added an answer on June 14, 2026 at 8:36 am

    There are several little bits of optimization you can do.

    1. cursor.getColumnIndex(Thumbnails.IMAGE_ID) will return the same value for every iteration through the cursor. Assign it to a variable outside the loop.
    2. String[] filePathColumn is assigned the same value on every iteration (and creates a new object on every iteration as well). Move it outside the loop.
    3. For the inner Cursor, MediaStore.Images.Media._ID + "=?" always has the same value. Outside the loop 🙂
    4. Instead of creating out as a String and appending to it, consider using java.lang.StringBuilder instead.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm intending to create a flash app that pulls images from facebook and displays
I have a flash app (deployed as Air or regular app for iOS) which
We have a Flash app (AS3). This is a desktop application that runs in
I have a flash app which will send/receive a constant stream of data. the
I have a AS3 flash app that needs to create a folder/path (online) for
I have a mapping application written in a flex/flash app. This app is used
I have a flash app which sends raw data for a jpg image to
how i can communicate with my flash app ? i load in my extension
I've seen a few sites that have a flash app which takes video from
i am a newbie to flash builder! i am trying to create an app

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.