𧱠Dynamic Components Extension
that supports every component in your AI2 distribution, instead of having pre-defined components.I thought about making a full method to create all dynamic components without creating different blocks for every component because it would be useless. So I was trying to find a proper solution for a long time. And here it is!
The minimum required API version for this extension is 1 .
It basically uses Javaâs Reflection feature, so this allows you to create ANY component you want dynamically which added to your AI2 distribution. Not only a Button
, but you can also even create a DatePicker
dynamically. Just type the componentâs name which you want to create, thatâs it!
What is the reflection and how does it work?
Reflection (in programming) allows you to modify the program during runtime, for example, you can create a new Class, Method, etc. and search them by its names!
Basically, it appends componentName
parameter to the com.google.appinventor.components.runtime.
text and creates an instance of it. When you type âButtonâ, it searches for Button class and creates an instance of it.
So with this method, it is now a fully implemented dynamic component extension.
I must say Java is a powerful language
đ§©
Blocks
You can click on the image to expand it.
â
FAQ
-
How can I set the properties for the blocks?
You have two options and both does the same job:-
SetProperty
- or
Any Component
-
-
How can I delete all components?
Use a for-each loop for that.
-
How can I make my own Schema template?
Thanks for being interested in making a JSON template for the extension. You can go to the Wiki section of Dynamic Componentâs repository to learn how to create yours.
Creating Templates - DynamicComponents-AI2 Wiki -
Is extension works asynchronously, or synchronously?
It works synchronously. I explained why it works synchronously in this post.
Now you can toggle between asynchronously or synchronously with theThread
property! -
App takes a lot of time to create components that use Image components, how can I fix it?
Replace your existing set Image.Picture components with the Image Utilities component.
If you donât use Kodular, you can use an extension to load images asynchronously. -
How much time it takes to create components?
I created more than 10 000 components and calculated how many seconds will it take to finish creating. Here are the benchmark results.
đ
Showcase
What projects made with this extension in the community? Here is a list below. Just mention me, PM me, or link this topic in your topic to get your project showed listed here!
Note: I no longer list projects due to receiving high volume of notifications. You can search for âDynamic Componentsâ in community search.
Note that these projects belong to their original posters, Iâm not affiliated with these projects in any way.
Show projects
Here is the list of projects that use the Dynamic Components extension. Ordered chronologically.
đ
Download
Version 2.3.0
com.yusufcihan.DynamicComponents.aix (36.6 KB) (v2.3.0)
Looking for old releases and changelog? Check it from here.
GitHub
You can report bugs, download old releases, contribute the code, and do more from the repository! The code is licensed with MIT license, as said in README.md and LICENSE files.
Donate
Creating a donation page didnât and wonât prevent me from making free and open source stuff, never. I will continue what I do as always, with donations or without them. However, if you like my content, you can support me on Buy Me A Coffee. Thanks for being interested
You can post in topic for help, a question about this extension, or PM me anything about you want to talk about!
- Yusuf Cihan