Hej. I do not really get the intent of the class android.widget.RemoteViews. What is its proper use case?
Regards. On 10 Aug., 16:50, Craig <craig.det...@gmail.com> wrote: > Thanks Jeff, the work-around works well. > > On Aug 7, 7:45 pm, Jeff Sharkey <jshar...@android.com> wrote: > > > Doh, good catch. The View.setVisibility() method is marked with the > > @android.view.RemotableViewMethod annotation, which is what allows it > > to be called through RemoteViews. In this case,ProgressBaractually > > overrides the default View implementation, but without adding that > > annotation. (This is why it throws the exception.) > > > One quick workaround is to wrap theProgressBarinto a simple view > > like FrameLayout, and then setVisibility() on that wrapper. > > > j > > > On Fri, Aug 7, 2009 at 3:49 PM, Craig<craig.det...@gmail.com> wrote: > > > > 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. Settingvisibilityworks fine with TextView fields or > > > ImageView fields or ImageButtons. However,ProgressBardoesn't seem to > > > work. It doesn't make sense that just the progress bar type isn't > > > supported for controllingvisibility. 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"> > > > > <ProgressBarandroid: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.ProgressBarcan'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) > > > -- > > Jeff Sharkey > > jshar...@android.com > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---