adding android:widgetCategory="keyguard|home_screen" while still supporting older sdk
Asked Answered
A

2

8

I am trying to modify my widget so that it supports being placed on 4.2 lockscreens. However I still want to support older SDK's.

I added

android:widgetCategory="keyguard|home_screen"

to my appwidget-provider in res/xml, but eclipse complains that there is "no resource identifier found for attribute widetCategory in package android'

If I raise the minSdkVerion to 17 everything works fine, but I want to still support older SDKs.

I have tried using resource qualifiers creating a separte res/xml-v17/mywidget.xml and only adding the tag there, but the error still appears.

Thanks for any help.

Edit: I figured it out. using a res/xml-v17/ folder is the answer. I just had to change the build target for my project to 17 / 4.2.

Ankylosaur answered 20/11, 2012 at 7:42 Comment(0)
H
9

I think that setting targetSdk to 17 is enough. XML elements that do not make sense on older SDKs are simply ignored.

No need to put mywidget.xml into res/xml-v17 folder

Hoptoad answered 26/11, 2012 at 8:22 Comment(0)
B
6

Put a copy of your mywidget.xml in res/xml-v17/ folder. This targets Android 4.2 and all new "properties on the appwidget-provider element will be avaible. Also right click your project in eclipse and change build target to: API level 17/ Android 4.2

I saw your Edit. But i think this makes it more clear that this question have an answer.

UPDATE: I can confirm Tomáš Hubálek answer. the xml-v17 is not needed. Changing Build target is enough. Right click your project in eclipse and change build target to: API level 17/ Android 4.2

Breedlove answered 22/11, 2012 at 8:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.