I was trying to set a progress bar to View.INVISIBLE or View.GONE, or View.VISIBLE inside an AppWidgetProvider. However, it doesn't seem to want to do it. Setting visibility works fine with TextView fields or ImageView fields or ImageButtons. However, ProgressBar doesn't seem to work. It doesn't make sense that just the progress bar type isn't supported for controlling visibility. Has anyone else seen this problem?
The code: @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { RemoteViews updateViews = new RemoteViews(context.getPackageName(), R.layout.a_widget_home_screen); updateViews.setViewVisibility(R.id.progress_bar, View.VISIBLE); } <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ProgressBar android:id="@+id/progress_bar" android:layout_height="32px" android:layout_width="32px" android:indeterminate="true" android:layout_marginLeft="110px" android:layout_marginTop="120px" android:visibility="gone" /> </RelativeLayout> This is the error: 08-07 17:42:42.633: WARN/AppWidgetHostView(102): updateAppWidget couldn't find any view, using error view 08-07 17:42:42.633: WARN/AppWidgetHostView(102): android.widget.RemoteViews$ActionException: view: android.widget.ProgressBar can't use method with RemoteViews: setVisibility(int) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at android.widget.RemoteViews$ReflectionAction.apply(RemoteViews.java: 443) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at android.widget.RemoteViews.performApply(RemoteViews.java:855) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at android.widget.RemoteViews.apply(RemoteViews.java:832) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at android.appwidget.AppWidgetHostView.updateAppWidget (AppWidgetHostView.java:167) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at android.appwidget.AppWidgetHost.updateAppWidgetView(AppWidgetHost.java: 243) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at android.appwidget.AppWidgetHost$UpdateHandler.handleMessage (AppWidgetHost.java:73) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at android.os.Handler.dispatchMessage(Handler.java:99) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at android.os.Looper.loop(Looper.java:123) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at android.app.ActivityThread.main(ActivityThread.java:3948) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at java.lang.reflect.Method.invokeNative(Native Method) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at java.lang.reflect.Method.invoke(Method.java:521) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:782) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540) 08-07 17:42:42.633: WARN/AppWidgetHostView(102): at dalvik.system.NativeStart.main(Native Method) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---