How to programmatically change android: autoStart attribute for ViewFlipper in RemoteViews?

I am creating an appWidget with multiple views and flipping views. Basically, it works. But I have no idea how I can programmatically override the view in RemoteViews.

this is the xml layout for flipping

<ViewFlipper android:id="@+id/vf_slot_0" android:layout_width="fill_parent" android:layout_height="75dp" android:autoStart="true" android:flipInterval="10000"> 

and this is the code

 RemoteViews mViews = new RemoteViews(context.getPackageName(), R.id.flipping_view); mViews.setBoolean(R.id.vf_slot_0, "setAutoStart", false); mViews.setInt(R.id.vf_slot_0, "setFlipInterval", 1000); 

'setFlipInterval' works. I can change the drop interval programmatically using this code. But "setAutoStart" is not. And get this error.

 08-19 01:45:38.821: WARN/AppWidgetHostView(2889): android.widget.RemoteViews$ActionException: view: android.widget.ViewFlipper can't use method with RemoteViews: setAutoStart(boolean) 

I wonder why I cannot use 'setAutoStart' while I can use 'setFlipInterval'. Is there any way I can start or stop flipping images in an appWidget application?

+4
source share
2 answers

I think I should conclude this by stating that the setAutoStart method with RemoteViews is not supported.

0
source

I am trying to find where I read this, but if I remember correctly, ViewFlipper stops if it is set to invisible. But I can’t find it now. So, if this is true, try:

 mViews.setViewVisibility(R.id.vf_slot_0, View.INVISIBLE); 
+1
source

All Articles