AppWidgetでremoveAllViewsがきかない

330 views
Skip to first unread message

坊珍

unread,
Apr 1, 2013, 4:43:43 AM4/1/13
to android-g...@googlegroups.com
お世話になります。
 
現在ウィジェットを作成しようと思い、試行錯誤中です。
 
そこで、とある条件になった場合に、
指定したViewを削除したいのですが、
なぜかremoveAllViewsがきかなくて困っています。
 
layout.xmlで、
 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
 
  <RelativeLayout
       android:layout_width="fill_parent"
       android:layout_height="fill_parent"
       android:id="@+id/root"
   >
   <AnalogClock
       android:id="@+id/clock"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent"
       android:dial="@drawable/dial"
       android:hand_hour="@drawable/hour"
       android:hand_minute="@drawable/minute" />
  </RelativeLayout>
 </LinearLayout >
 
としており、
Sample.javaの方で
 
RemoteViews rv = new RemoteViews(cn.getPackageName(), R.layout.layout);
rv.removeAllViews(R.id.root);
 
と記述したのですが、アナログ時計が消えません。
 
記述方法が間違っているのでしょうか。
ご教授いただければとおもいます。
 
よろしくお願いいたします。
 

しかじろう

unread,
Apr 2, 2013, 12:20:44 AM4/2/13
to android-group-japan
しかじろうです。

> Sample.javaの方で
このクラスは何者ですか?
AppWidgetProvider?RemoteViewsService?その他?

removeなどのメソッドを呼んだ後、updateの処理はされてますか?
appWidgetはupdateしないと描画しないです。





2013/4/1 坊珍 <fuka...@gmail.com>:
> --
> このメールは Google グループのグループ「日本Androidの会」の登録者に送られています。
> このグループから退会し、メールの受信を停止するには、android-group-j...@googlegroups.com
> にメールを送信します。
> このグループに投稿するには、android-g...@googlegroups.com にメールを送信してください。
> http://groups.google.com/group/android-group-japan?hl=ja
> からこのグループにアクセスしてください。
> その他のオプションについては、https://groups.google.com/groups/opt_out にアクセスしてください。
>
>



--
/**
* @name : しかじろう【渡辺 慎二郎】
* @blog : http://shikajiro.github.com/
* @mail : shik...@gmail.com
* @profile http://shikajiro.github.com/#/about/index
*/

坊珍

unread,
Apr 2, 2013, 8:25:13 PM4/2/13
to android-g...@googlegroups.com
ありがとうございます。
 
upodate処理をしていなかったのが原因でした。
初歩的なミスでお恥ずかしい限りです。
 
 

2013年4月2日火曜日 13時20分44秒 UTC+9 shikajiro:
> このグループから退会し、メールの受信を停止するには、android-group-japan+unsubscribe@googlegroups.com
> にメールを送信します。
> このグループに投稿するには、android-group-ja...@googlegroups.com にメールを送信してください。
Reply all
Reply to author
Forward
0 new messages