开发者

Selective AppWidgets

开发者 https://www.devze.com 2023-03-15 14:10 出处:网络
I have a app which has 2 widgets, lets call them SimpleWidget and ListWidget. ListWidget makes use of android 3.1 (api level 12) features.

I have a app which has 2 widgets, lets call them SimpleWidget and ListWidget. ListWidget makes use of android 3.1 (api level 12) features.

What I would like to do is register both widgets if the device is 3.1 or above. If it is not than I would only want to register SimpleWidget.

As the code stands now the widgets are defined in my app's AndroidManifest.xml file. I can't figure out how I could filter this by 开发者_如何学运维sdk level.

The only solution I have found so far would still display both widgets (in android's add widget page) even on pre 3.1 devices (in which case I relegate ListWidget to a SimpleWidget).

Am I missing something?

For example can I register widgets in Java code (maybe in the app's onCreate method) instead of in the manifest file? (seems unlikely since the info is needed before the app is ever run).

0

精彩评论

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

关注公众号