Hi all, I am attempting to query a database and update information in the appwidget screen based on changes to the database done while in an activity - so that when the user exits, the changes are reflected in the widget on the screen. The appwidget is being updated with a broadcast from OnPause() and OnStop() in my primary Activity. Relevant pieces of the code are below. The Toast shows me that the data is correctly being pulled when OnUpdate() is called. But the widget refused to change! Help me! I'm tearing my hair out here :)
public class QwikButton extends AppWidgetProvider { public String listuuid = ""; public String title = ""; public String listfinal = ""; public String[] listitems = null; @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { setupDBs(context); RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.main); listfinal = ""; listuuid = this.getUUID(context); title = this.getTitle(context, listuuid); listitems = this.getItems(context, listuuid); if (listitems == null) { listfinal = "No items in this list."; rv.setTextViewText(R.id.lv_list, listfinal);} else { for (String s : listitems) { listfinal += s; } listfinal = listfinal.subSequence(0, listfinal.length()-2).toString (); rv.setTextViewText(R.id.lv_list, listfinal); } Toast.makeText(context, listuuid+title+listfinal +appWidgetIds.toString(), Toast.LENGTH_LONG).show(); rv.setTextViewText(R.id.tv_title, title); /* ... lots of irrelevant code ... */ appWidgetManager.updateAppWidget(appWidgetIds, rv); } /* ... lots of irrelevant code ... */ } Layout main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:layout_width="fill_parent" android:orientation="vertical" android:background="@drawable/bg2x2" android:layout_gravity="center" android:layout_height="fill_parent" android:id="@+id/background"> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <Button android:background="@drawable/microphone" android:id="@+id/ button_two" android:layout_gravity="center_horizontal|center" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentRight="true" android:layout_marginLeft="0dip" android:layout_marginTop="10dip" android:layout_marginRight="8.5dip" /> <Button android:background="@drawable/openfolder" android:id="@+id/ button_one" android:layout_gravity="center_horizontal|center" android:layout_marginLeft="0dip" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_toLeftOf="@id/ button_two" android:layout_alignTop="@id/button_two" /> <Button android:background="@drawable/mail" android:id="@+id/ button_gmail" android:layout_gravity="center_horizontal|center" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_toLeftOf="@id/button_one" android:layout_alignTop="@id/button_two" /> </RelativeLayout> <TextView android:text="Title" android:id="@+id/tv_title" android:layout_gravity="center_horizontal|center" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_toLeftOf="@id/button_one" android:textColor="#000000" android:layout_centerVertical="true" android:textSize="16.0sp"> </TextView> <TextView android:text="List/nList/nList" android:id="@+id/lv_list" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_marginLeft="18dip" android:layout_marginRight="8dip" android:textColor="#000000" android:textSize="10.0sp"> </TextView> </LinearLayout> <?xml version="1.0" encoding="utf-8"?> <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/ android" android:minWidth="146dip" android:minHeight="146dip" android:updatePeriodMillis="1000" android:initialLayout="@layout/ main" /> -- 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