vendredi 30 juin 2017

Android: Is it possible to download the class (which is an extend of LinearLayout) of an android custom View and instantiate it in runtime?

I'm developing an app which has a thing called widgets(not to be confused with android widgets that you can keep on the desktop)

Widget is an abstract class that extends LinearLayout.

Now we can extend Widget and create various Widgets that do various tasks such as,

AlarmWidget - A Widget that blinks at the time you set
ClockWidget - A Widget that display time.

When I distribute the app it will come with some built in widgets that I have coded in my project including the above 2.

But I want developer community to be able to create custom Widgets like the above 2 that will be hosted in a server and can be downloaded by users.

It is not possible to let a user download all the available Widgets on the server through an update due to the large combined size of all the widgets

So the app will download the required class(an extension of Widget class) from server when necessary and instantiate the View.

Each extension of Widget is a complex object containing many child Views attached to it and its own unique methods and code. (therefore not possible to instantiate the class by transferring only information like color,text,backgroundimage etc)

How do I do this?





Aucun commentaire:

Enregistrer un commentaire