I am trying to find a way to create an instance of any type of object using the typename.
I need to create objects at runtime. I know this is kind of frowned upon but in some cases when writing classes to be used in other projects, this function is needed.
To be used like this:
This is a very simple example that doesn't make much sense to any application but it demonstrates how it could be used.
Is there a function or existing library that can do this and if not what would be the best way to accomplish this?
I need to create objects at runtime. I know this is kind of frowned upon but in some cases when writing classes to be used in other projects, this function is needed.
To be used like this:
B4X:
Dim obj as object
obj = CreateInstance("b4a.example.fruit")
This is a very simple example that doesn't make much sense to any application but it demonstrates how it could be used.
Is there a function or existing library that can do this and if not what would be the best way to accomplish this?
Last edited: