开发者

Dynamically creating Widgets on Android

开发者 https://www.devze.com 2022-12-29 18:06 出处:网络
Is it possible to 开发者_开发知识库create multiple widgets in runtime? Application (Activity) should generate in some cases new widget(or edit exist) with new name and label and do some primitive acti

Is it possible to 开发者_开发知识库create multiple widgets in runtime? Application (Activity) should generate in some cases new widget(or edit exist) with new name and label and do some primitive action on click, which should be available in desktop widgets menu.


Is it possible to create multiple widgets in runtime?

No.

Application (Activity) should generate in some cases new widget(or edit exist) with new name and label and do some primitive action on click, which should be available in desktop widgets menu.

That is not possible. App widgets must be declared in the manifest, which cannot be modified at runtime.

Sorry!


You can create a widget when its first added to the home screen, I dont like this idea though.

If you wanted you could declare X number of widgets in the manifest and create the Views in the onCreate() method.

0

精彩评论

暂无评论...
验证码 换一张
取 消