I am developing multiple widgets, One of them uses ListView but ListView is not supported by Android 2.3.
So, if my app is installed in Android 2.3 at that time widget with ListView should not display in widget's list.
But my that widget with ListView is showing in widget's list and if i click on it than it shows me Force Closed.
That's why i want to hide Those Widgets from widget's list.
If any one has any suggestions please reply.
It shows me Force Closed and following Error for widget
Same widget i run in Android 4.2 then it shows me as per following list
Thank you.
I am developing multiple widgets
No, you are developing multiple app widgets. While I am sorry that the terms are confusing, it is very important for you to use the right terminology in your question.
One of them uses ListView but ListView is not supported by Android 2.3.
Correct, ListView
is not supported in app widgets in Android 2.3 or lower.
So, if my app is installed in Android 2.3 at that time widget with ListView should not display in widget's list.
Step #1: Create a res/values/bools.xml
file, defining a boolean resource, with a name of is_honeycomb
, and a value of false
.
Step #2: Create a res/values-v11/bools.xml
file, defining another boolean resource, with the same name (is_honeycomb
), and a value of true
Step #3: In your manifest, on the <receiver>
element for the AppWidgetProvider
that uses a ListView
, add android:enabled="@bool/is_honeycomb"
.
The net effect is that on Android 3.0+ devices, your ListView
app widget will be an available option, but on Android 2.3 and lower devices, it will not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With