[FREE] Async Image Loader Extension - Simple asynchronous image loader with circular image

AsyncImage

An extension for MIT App Inventor 2.

Simple asynchronous image loader extension to load image asynchronously in an image or arrangement component with circular image. This is a simple, light weight and fast async image loader since it does not uses any external library to load images.

:memo: Specifications


:floppy_disk: Size: 9.36 KB
:gear: Version: 5.0
:iphone: Minimum API Level: 7
:date: Updated On: 2025-02-17T18:30:00Z
:computer: Built & documented using: FAST-CLI

Event:

AsyncImage has total 1 event.

:yellow_heart: OnError

OnErrorBlock

Event raised when an error occurs while loading an image.

Parameter Type
errorMessage text

Methods:

AsyncImage has total 2 methods.

:purple_heart: LoadImageAsync

LoadImageAsyncBlock

Load image asynchronously from the given path in the specified component.

Parameter Type
imagePath text
component component

:purple_heart: ClearCache

ClearCacheBlock

Clears the image cache memory.

Designer:

AsyncImage has total 5 designer properties.

:green_apple: PlaceholderImage

  • Input type: asset

:green_apple: ErrorImage

  • Input type: asset

:green_apple: CircularImage

  • Input type: boolean
  • Default value: false

:green_apple: BorderWidth

  • Input type: integer
  • Default value: 0

:green_apple: BorderColor

  • Input type: color
  • Default value: &HFF000000

Setters:

AsyncImage has total 5 setter properties.

:green_heart: PlaceholderImage

PlaceholderImageBlock

Sets the placeholder image to be shown while the image is loading.

  • Input type: text

:green_heart: ErrorImage

ErrorImageBlock

Sets the error image to be shown if loading the image fails.

  • Input type: text

:green_heart: CircularImage

CircularImageBlock

Set to true to make the loaded image circular.

  • Input type: boolean

:green_heart: BorderWidth

BorderWidthBlock

Specifies the width of the border around the loaded image.

  • Input type: number

:green_heart: BorderColor

BorderColorBlock

Specifies the color of the border around the loaded image.

  • Input type: number

Sample Blocks:


Download:

v5.0 com.thekstudio.asyncimage.aix (9.4 KB)

5 Likes

Spelling in aix filename (Aync)

Also, for others may help to indicate the benefits of using this extension, over just loading an image...

Oops typo...corrected. Thanks!

Updated

You can load image from various sources like assets, local file from ASD or online.
Now you can load image in an arrangement like vertical, horizontal or scroll arrangement.
Added event onError in case failed to load image.

Is there some information on this ?

Yes, I created this extension for Kodular, as the Kodular inbuilt async image loader block from image utilities component doesn't work due to permission error in higher Android versions.

This extension overcomes that problem as this does not uses any permission.

Specially using with Dynamic component extension when loading large list data that includes images, the app lags until all the images getting loaded synchronously, by using async image loader this problem can be fixed.

From that I read that the benefit comes when loading (large) lists of images in one go, or a single large image?

As I said, large list data that includes images either small size or large size images, it takes time for loading as it loads synchronously until all images getting loaded, and sometimes the app crashes due to this.

Updated:

1 Like

I'm having a hard time understanding the difference between a 'for component' and 'component'. Thank you in advance.

You're using the "Any Component" version of this block (notice how it says AsyncImage instead of AsyncImage1 or similar). The "for component" parameter here accepts a component and changes a property for that component. If you look at the component-specific blocks, they do not have the "for component" socket:

image

I see what you mean. Odd that when I click on the AsyncImage1 component, no objects display. I tried reloading it but still the same long vertical gray area.

You can set the for component and component to same component in which you want to load the image.

I did that but am getting an error: The operation LoadImageAsync cannot accept the arguments: , ["com.google.appinventor.components.runtime.Image@541de13"]

Do not use load async image block from any component.

Use normal load async image block from the extension like below.

If extension is not showing the blocks then there might be issue with your project, onxe delete the extension and import again. Or try in a new project.

I re-installed it twice. Same results. That large vertical gray strip is all I see. I tried Firefox, MS Edge and Chrome browsers. All the same ressults. Maybe the component I downloaded is corrupted inside. I did download the V4 version.

Delete the old file and re download the extension again from main post.

May be try in a new project.

1 Like

That finally did it -- it worked! Thank you very much.

1 Like

v5.0 Updated:

  1. Added image cache feature
  2. Clear cache function to clear the cache memory
  3. Added placeholder image (showed until image loads) and error image (showed in case image load fails) (can be set from assets and local image)
  4. Extension re-built with FAST
1 Like

What a great and wonderful extension,, you always do excellent work dude

1 Like