Read the mysql and display the value on the text box

Finally, I can load the country flags and play their radio respectively. But the App responds a bit slowly. May I know what I can improve it?
getCh2.aia (38.0 KB)

It is slow because of the time it takes to get all of the images (even though they are small in size). Just remove the image block and replace it with an empty test block, you will see the difference.

Might be better to download the images to the device on first run, then load them to the list view from the local files. (or get all the images and upload them to the media folder - assets - in the app)

I have completely reworked it (gone back to AI2 lists), and loaded images to the assets.

There is still a delay while the player get the radio source, but i used a notifier progress dialog to help with that.

Two of your stations; Philippines and Italy do not work with the player, so I have removed those from your json.

getCh2Slow2.aia (97.7 KB)

Thank you for your kind assistance, please allow me to study from your working again.

If you haven't yet noticed, there is a Country.json file at

with flag emojis.

That should help speed up lookups, since it's all local.

Took @ABG 's advice, and reworked your json to include flag emojis (also removed the elements from the json that were not being used).

getCh2Emoji.aia (6.0 KB)

Thank you for both again. I will learn it in deep.

I know that there are country short names added on the JSON file, but I don't know how the App inventor makes emoji for the respective countries as I did not see the emoji block.

They may look like short codes, but they are in fact emojis as text.

The listview and label components convert these to display the image.

So what if I add a new country short name on Json, it will also show the new added country flag, right?

You will need to copy the "emoji text" for the country from the Country.json file ABG linked to above

You may also find this of use:

especially for those streams that do not work with the player component

May I know if the indexes on the following block point to the correct indexes on JSON?

  1. You will need to look at the list content generated by "values" to see what order the elements are in.

  2. I see you have not correctly copied the emoji textfor the flag,
    it should look like this: "flag": "🇺🇸"

Time to read up on dictionaries and JSON ...

It is safer to request by key than by position, which is not guaranteed.

The return order of values is stable (i.e. it doesn't change from one call to the next), but may change if new items are added to the json

I have made some changes on top of your AIA, as I put the flag emoji into MySQL and exported it to JSON, as it is easier for me to modify the list in the future. But I got the error when refreshing the screen below.


getCh4 New.aia (47.2 KB)

You are trying to get item 0 of your table.

A List Picker or ListView's SelectionIndex is 0 before you select something.

You somehow jumped the gun on your Selection process?

image

Turn off the Clock in the Designer.
It's like storing lit fireworks.

Thank you for fixing my problem. :laughing:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.