开发者

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

I am building an appWidget that has multiple views and flips the views. Basically, it's working. But I have no idea how I can stop view flipping in RemoteViews programmatically.

this is 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' is working.开发者_JAVA技巧 I can change flipping interval programmatically by using this code. But 'setAutoStart' isn't. And getting 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)

Wondering why I can't use 'setAutoStart' while I can use 'setFlipInterval'. Is there any way I can start or stop flipping images in my appWidget programmatically?


I am trying to locate where I read this, but if I recall correctly, the ViewFlipper stops if set to invisible. But I can't seem to find it now. So, if that is true try:

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


I think I have to conclude it by stating setAutoStart method with RemoteViews is not supported.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜