Java Code Examples for android.appwidget.AppWidgetManager#notifyAppWidgetViewDataChanged()

The following examples show how to use android.appwidget.AppWidgetManager#notifyAppWidgetViewDataChanged() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProfileListWidgetProvider.java    From PhoneProfilesPlus with Apache License 2.0 6 votes vote down vote up
private static void doOnUpdate(Context context, AppWidgetManager appWidgetManager, int appWidgetId, boolean fromOnUpdate)
{
    Bundle widgetIdOptions;
    widgetIdOptions = appWidgetManager.getAppWidgetOptions(appWidgetId);
    boolean isLargeLayout = setLayoutParams(context, appWidgetManager, appWidgetId, widgetIdOptions);
    DataWrapper dataWrapper = new DataWrapper(context.getApplicationContext(), false, 0, false);
    RemoteViews widget = buildLayout(context, appWidgetId, isLargeLayout, dataWrapper);
    try {
        appWidgetManager.updateAppWidget(appWidgetId, widget);
    } catch (Exception e) {
        PPApplication.recordException(e);
    }

    if (!fromOnUpdate) {
        if (isLargeLayout) {
            if (!ApplicationPreferences.applicationWidgetListGridLayout)
                appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId, R.id.widget_profile_list);
            else
                appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId, R.id.widget_profile_grid);
        }
    }
}
 
Example 2
Source File: BookmarkWidgetProvider.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private void performUpdate(Context context,
        AppWidgetManager appWidgetManager, int[] appWidgetIds) {
    for (int appWidgetId : appWidgetIds) {
        Intent updateIntent = new Intent(context, BookmarkWidgetService.class);
        updateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
        updateIntent.setData(Uri.parse(updateIntent.toUri(Intent.URI_INTENT_SCHEME)));

        int layoutId = shouldShowIconsOnly(appWidgetManager, appWidgetId)
                ? R.layout.bookmark_widget_icons_only
                : R.layout.bookmark_widget;
        RemoteViews views = new RemoteViews(context.getPackageName(), layoutId);
        views.setRemoteAdapter(R.id.bookmarks_list, updateIntent);

        appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId, R.id.bookmarks_list);
        Intent ic = new Intent(context, BookmarkWidgetProxy.class);
        views.setPendingIntentTemplate(R.id.bookmarks_list,
                PendingIntent.getBroadcast(context, 0, ic,
                PendingIntent.FLAG_UPDATE_CURRENT));
        appWidgetManager.updateAppWidget(appWidgetId, views);
    }
}
 
Example 3
Source File: WidgetProvider.java    From Birdays with Apache License 2.0 6 votes vote down vote up
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
                     int[] appWidgetIds) {
    super.onUpdate(context, appWidgetManager, appWidgetIds);

    for (int i : appWidgetIds) {

        RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_layout);
        Intent serviceIntent = new Intent(context, WidgetService.class);
        serviceIntent.setData(Uri.parse(serviceIntent.toUri(Intent.URI_INTENT_SCHEME)));
        remoteViews.setRemoteAdapter(R.id.listview_widget, serviceIntent);

        remoteViews.setTextViewText(R.id.textview_widget_header_date,
                Utils.getDateWithoutYear(Calendar.getInstance().getTimeInMillis()));

        Intent clickIntent = new Intent(context, WidgetProvider.class);
        clickIntent.setAction(ACTION_ON_CLICK);

        PendingIntent clickPendingIntent = PendingIntent.getBroadcast(context, 0,
                clickIntent, PendingIntent.FLAG_UPDATE_CURRENT);
        remoteViews.setPendingIntentTemplate(R.id.listview_widget, clickPendingIntent);

        appWidgetManager.updateAppWidget(i, remoteViews);
        appWidgetManager.notifyAppWidgetViewDataChanged(i, R.id.listview_widget);
    }
}
 
Example 4
Source File: BookmarkWidgetProvider.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private void performUpdate(Context context,
        AppWidgetManager appWidgetManager, int[] appWidgetIds) {
    for (int appWidgetId : appWidgetIds) {
        Intent updateIntent = new Intent(context, BookmarkWidgetService.class);
        updateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
        updateIntent.setData(Uri.parse(updateIntent.toUri(Intent.URI_INTENT_SCHEME)));

        int layoutId = shouldShowIconsOnly(appWidgetManager, appWidgetId)
                ? R.layout.bookmark_widget_icons_only
                : R.layout.bookmark_widget;
        RemoteViews views = new RemoteViews(context.getPackageName(), layoutId);
        views.setRemoteAdapter(R.id.bookmarks_list, updateIntent);

        appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId, R.id.bookmarks_list);
        Intent ic = new Intent(context, BookmarkWidgetProxy.class);
        views.setPendingIntentTemplate(R.id.bookmarks_list,
                PendingIntent.getBroadcast(context, 0, ic,
                PendingIntent.FLAG_UPDATE_CURRENT));
        appWidgetManager.updateAppWidget(appWidgetId, views);
    }
}
 
Example 5
Source File: ListWidget.java    From kolabnotes-android with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
    // update each of the app widgets with the remote adapter
    for (int i = 0; i < appWidgetIds.length; ++i) {
        updateAppWidget(context,appWidgetManager,appWidgetIds[i]);
    }
    appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.widget_list_notes);
    super.onUpdate(context, appWidgetManager, appWidgetIds);
}
 
Example 6
Source File: WidgetUnified.java    From FairEmail with GNU General Public License v3.0 5 votes vote down vote up
static void updateData(Context context) {
    Log.i("Widget unified update");
    if (ActivityBilling.isPro(context)) {
        AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
        if (appWidgetManager == null) {
            Log.w("No app widget manager"); // Fairphone FP2
            return;
        }

        try {
            int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, WidgetUnified.class));
            appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.lv);
        } catch (Throwable ex) {
            Log.e(ex);
        /*
            java.lang.RuntimeException: system server dead?
              at android.appwidget.AppWidgetManager.getAppWidgetIds(AppWidgetManager.java:1053)
              at eu.faircode.email.Widget.update(SourceFile:111)
              at eu.faircode.email.ServiceSynchronize$6.onChanged(SourceFile:460)
              at eu.faircode.email.ServiceSynchronize$6.onChanged(SourceFile:439)
              at androidx.lifecycle.LiveData.considerNotify(SourceFile:131)
              at androidx.lifecycle.LiveData.dispatchingValue(SourceFile:149)
              at androidx.lifecycle.LiveData.setValue(SourceFile:307)
              at androidx.lifecycle.LiveData$1.run(SourceFile:91)
            Caused by: android.os.DeadObjectException
         */
        }
    }
}
 
Example 7
Source File: SuntimesWidget1.java    From SuntimesWidget with GNU General Public License v3.0 5 votes vote down vote up
protected static void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId)
{
    RemoteViews views = getWidgetViews(context, appWidgetManager, appWidgetId);
    views.setOnClickPendingIntent(R.id.widgetframe_outer_1x1, SuntimesWidget0.clickActionIntent(context, appWidgetId, SuntimesWidget1.class));

    appWidgetManager.updateAppWidget(appWidgetId, null);   // null on this line to discard previously cached RemoveViews
    appWidgetManager.updateAppWidget(appWidgetId, views);  // so this next line actually updates...

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
    {
        appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId, R.id.view_flip);
    }
}
 
Example 8
Source File: DetailWidgetProvider.java    From Advanced_Android_Development with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceive(@NonNull Context context, @NonNull Intent intent) {
    super.onReceive(context, intent);
    if (SunshineSyncAdapter.ACTION_DATA_UPDATED.equals(intent.getAction())) {
        AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
        int[] appWidgetIds = appWidgetManager.getAppWidgetIds(
                new ComponentName(context, getClass()));
        appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.widget_list);
    }
}
 
Example 9
Source File: MyAppWidgetProvider.java    From simpletask-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onUpdate(@NonNull Context context, @NonNull AppWidgetManager appWidgetManager,
		@NonNull int[] appWidgetIds) {
       for (int widgetId : appWidgetIds) {
           Log.d(TAG, "onUpdate " + widgetId);
		RemoteViews views = updateView(widgetId, context);
		appWidgetManager.updateAppWidget(widgetId, views);

           // Need to updateCache the listView to redraw the listItems when
           // Changing the theme
           appWidgetManager.notifyAppWidgetViewDataChanged(widgetId,R.id.widgetlv);
	}
}
 
Example 10
Source File: PostsPresenter.java    From Capstone-Project with MIT License 5 votes vote down vote up
@Override
public void updateWidgets(Context context) {
    AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
    int appWidgetIds[] = appWidgetManager.getAppWidgetIds(
            new ComponentName(context, PredatorPostsWidgetProvider.class));
    appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.list_view_posts);
}
 
Example 11
Source File: StackWidgetProvider.java    From glimmr with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    if (BuildConfig.DEBUG) Log.d(TAG, "onReceive");

    AppWidgetManager mgr = AppWidgetManager.getInstance(context);

    if (intent.getAction().equals(ACTION_START_VIEWER)) {
        //int appWidgetId = intent.getIntExtra(
        //        AppWidgetManager.EXTRA_APPWIDGET_ID,
        //        AppWidgetManager.INVALID_APPWIDGET_ID);
        int viewIndex = intent.getIntExtra(VIEW_INDEX, 0);
        String photoListFile = intent.getStringExtra(
                PhotoViewerActivity.KEY_PHOTO_LIST_FILE);
        Intent photoViewer = new Intent(context,
                PhotoViewerActivity.class);
        photoViewer.putExtra(
                PhotoViewerActivity.KEY_START_INDEX,
                viewIndex);
        photoViewer.setAction(PhotoViewerActivity.ACTION_VIEW_PHOTOLIST);
        photoViewer.putExtra(PhotoViewerActivity.KEY_PHOTO_LIST_FILE,
                photoListFile);
        photoViewer.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        photoViewer.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
        context.startActivity(photoViewer);
    } else if (intent.getAction().equals(ACTION_REFRESH)) {
        if (BuildConfig.DEBUG) Log.d(TAG, "got action_refresh");
        int appWidgetId = intent.getIntExtra(
                AppWidgetManager.EXTRA_APPWIDGET_ID,
                AppWidgetManager.INVALID_APPWIDGET_ID);
        mgr.notifyAppWidgetViewDataChanged(appWidgetId, R.id.stack_view);
    }
    super.onReceive(context, intent);
}
 
Example 12
Source File: CalenderWidget.java    From MuslimMateAndroid with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Function fire on system update widget
 *
 * @param context          Context of application
 * @param appWidgetManager App widget manger
 * @param appWidgetIds     Widget system ids
 */
@Override
public void onUpdate(Context context, final AppWidgetManager appWidgetManager, int[] appWidgetIds) {
    final int count = appWidgetIds.length;

    //set widget language with the system language
    Locale locale = new Locale(Resources.getSystem().getConfiguration().locale.getLanguage());
    Locale.setDefault(locale);
    Configuration config = new Configuration();
    config.locale = locale;
    context.getResources().updateConfiguration(config, context.getResources().getDisplayMetrics());
    this.context = context;

    //loop in all widgets
    for (int i = 0; i < count; i++) {
        svcIntent = new Intent(context, CalenderRemoteViewsService.class);
        final int widgetId = appWidgetIds[i];
        remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_calender);
        remoteViews.setRemoteAdapter(R.id.calendar_pager, svcIntent);
        appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds[i], R.id.calendar_pager);
        HGDate hgDate = new HGDate();
        hgDate.toHigri();
        remoteViews.setTextViewText(R.id.textView8, Dates.getCurrentWeekDay());
        remoteViews.setTextViewText(R.id.textView7, NumbersLocal.convertToNumberTypeSystem(context, hgDate.getDay() + ""));
        remoteViews.setTextViewText(R.id.textView24, NumbersLocal.convertToNumberTypeSystem(context, hgDate.getYear() + ""));
        remoteViews.setTextViewText(R.id.curr_month_txt, Dates.islamicMonthName(context, hgDate.getMonth() - 1));
        remoteViews.setTextViewText(R.id.curr_month_txt_other, showOtherMonth(hgDate));

        PendingIntent configPendingIntent = PendingIntent.getActivity(context, 0, new Intent(context, MainActivity.class), 0);
        remoteViews.setOnClickPendingIntent(R.id.relativeLayout, configPendingIntent);
        appWidgetManager.updateAppWidget(widgetId, remoteViews);

    }
}
 
Example 13
Source File: AppWidgetUtils.java    From OmniList with GNU Affero General Public License v3.0 5 votes vote down vote up
public static void notifyAppWidgets(Context context) {
    // Home widgets
    AppWidgetManager mgr = AppWidgetManager.getInstance(context);
    int[] ids = mgr.getAppWidgetIds(new ComponentName(context, ListWidgetProvider.class));
    LogUtils.d("Notifies AppWidget data changed for widgets " + Arrays.toString(ids));
    mgr.notifyAppWidgetViewDataChanged(ids, R.id.widget_list);
}
 
Example 14
Source File: AppWidgetProvider.java    From WanAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    super.onReceive(context, intent);
    if (intent.getAction().equals(REFRESH_ACTION)) {
        AppWidgetManager manager = AppWidgetManager.getInstance(context);
        ComponentName name = new ComponentName(context, AppWidgetProvider.class);
        manager.notifyAppWidgetViewDataChanged(manager.getAppWidgetIds(name), R.id.list_view_widget);
    }
}
 
Example 15
Source File: ExpensesWidgetProvider.java    From Expense-Tracker-App with MIT License 5 votes vote down vote up
@Override
    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
        for (int appWidgetId : appWidgetIds){
            Intent expenseDetailActivity = new Intent(context, ExpenseDetailActivity.class);
            Intent mainActivityIntent = new Intent(context, MainActivity.class);

            // Creating stack for builder item click
            TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(context);
            taskStackBuilder.addParentStack(MainActivity.class);
            taskStackBuilder.addNextIntent(mainActivityIntent);
            taskStackBuilder.addNextIntent(expenseDetailActivity);
            PendingIntent itemClickPendingIntent = taskStackBuilder.getPendingIntent(0 ,PendingIntent.FLAG_UPDATE_CURRENT);

            // Create pending intent for clicking the whole view, not an item
            PendingIntent mainPendingIntent = PendingIntent.getActivity(context, 0, mainActivityIntent, PendingIntent.FLAG_UPDATE_CURRENT);

            Intent widgetServiceIntent = new Intent(context, ExpensesWidgetService.class);
//            widgetServiceIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
//            widgetServiceIntent.setData(Uri.parse(widgetServiceIntent.toUri(Intent.URI_INTENT_SCHEME)));

            RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.widget_layout);
            remoteView.setOnClickPendingIntent(R.id.general_layout, mainPendingIntent);

            remoteView.setEmptyView(R.id.listViewWidget, R.id.empty_view);
            remoteView.setRemoteAdapter(appWidgetId, R.id.listViewWidget, widgetServiceIntent);
            remoteView.setTextViewText(R.id.tv_total, context.getString(R.string.today_expenses_total, Util.getFormattedCurrency(Expense.getTotalExpensesByDateMode(IDateMode.MODE_TODAY))));
            remoteView.setPendingIntentTemplate(R.id.listViewWidget, itemClickPendingIntent);
            ComponentName component=new ComponentName(context, ExpensesWidgetProvider.class);
            appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.listViewWidget);
            appWidgetManager.updateAppWidget(component, remoteView);
        }
    }
 
Example 16
Source File: TaskListWidgetUpdaterService.java    From opentasks with Apache License 2.0 4 votes vote down vote up
@Override
public void run()
{
    // load TaskLists for this widget
    WidgetConfigurationDatabaseHelper configHelper = new WidgetConfigurationDatabaseHelper(mContext);
    SQLiteDatabase db = configHelper.getWritableDatabase();

    ArrayList<Long> lists = WidgetConfigurationDatabaseHelper.loadTaskLists(db, mAppWidgetId);
    db.close();

    // build selection string
    StringBuilder selection = new StringBuilder(TaskContract.Instances.VISIBLE + ">0 and " + TaskContract.Instances.IS_CLOSED + "=0 AND ("
            + TaskContract.Instances.INSTANCE_START + "<=" + System.currentTimeMillis() + " OR " + TaskContract.Instances.INSTANCE_START
            + " is null OR " + TaskContract.Instances.INSTANCE_START + " = " + TaskContract.Instances.INSTANCE_DUE + " )");

    selection.append(" AND ").append(Instances.DISTANCE_FROM_CURRENT).append(" <=0 ");
    if (lists != null && !lists.isEmpty())
    {
        selection.append(" AND ( ");

        for (int i = 0; i < lists.size(); i++)
        {
            Long listId = lists.get(i);

            if (i < lists.size() - 1)
            {
                selection.append(Instances.LIST_ID).append(" = ").append(listId).append(" OR ");
            }
            else
            {
                selection.append(Instances.LIST_ID).append(" = ").append(listId).append(" ) ");
            }
        }
    }

    // load all upcoming non-completed tasks
    Cursor c = mContext.getContentResolver().query(
            TaskContract.Instances.getContentUri(mAuthority),
            null,
            selection.toString(),
            null,
            Instances.INSTANCE_DUE + " is null, " + Instances.DEFAULT_SORT_ORDER + ", "
                    + Instances.PRIORITY + " is null, " + Instances.PRIORITY + ", "
                    + Instances.INSTANCE_START + " is null, " + Instances.INSTANCE_START_SORTING + ", "
                    + Instances.CREATED + " DESC");

    if (c != null)
    {
        try
        {
            mItems = getWidgetItems(c);
        }
        finally
        {
            c.close();
        }
    }
    else
    {
        mItems = new TaskListWidgetItem[0];
    }

    // tell to only update the view in the next onDataSetChanged();
    mDoNotReload = true;

    // notify the widget manager about the update
    AppWidgetManager widgetManager = AppWidgetManager.getInstance(mContext);
    if (mAppWidgetId != -1)
    {
        widgetManager.notifyAppWidgetViewDataChanged(mAppWidgetId, R.id.task_list_widget_lv);

    }
}
 
Example 17
Source File: CourseAppWidgetProvider.java    From SmallGdufe-Android with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 通知界面去更新列表的UI,需要在修改列表数据后调用
 *  notifyAppWidgetViewDataChanged()会调用WidgetListProviderFactory的onDataSetChanged()方法
 * @param context
 */
private void notifyListUpdateUI(Context context) {
    AppWidgetManager mgr = AppWidgetManager.getInstance(context);
    ComponentName cn = new ComponentName(context, CourseAppWidgetProvider.class);
    mgr.notifyAppWidgetViewDataChanged(mgr.getAppWidgetIds(cn), R.id.desktop_widget_list);
}
 
Example 18
Source File: TaskListWidgetProvider.java    From opentasks with Apache License 2.0 4 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent)
{
    super.onReceive(context, intent);

    AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
    int[] appWidgetIds = appWidgetManager.getAppWidgetIds(getComponentName(context));
    String action = intent.getAction();
    if (action.equals(Intent.ACTION_PROVIDER_CHANGED))
    {
        appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.task_list_widget_lv);
    }
    else if (action.equals(ACTION_CREATE_TASK))
    {
        int widgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, 0);
        WidgetConfigurationDatabaseHelper configHelper = new WidgetConfigurationDatabaseHelper(context);
        SQLiteDatabase db = configHelper.getReadableDatabase();
        ArrayList<Long> widgetLists = WidgetConfigurationDatabaseHelper.loadTaskLists(db, widgetId);
        db.close();
        ArrayList<Long> writableLists = new ArrayList<>();
        String authority = AuthorityUtil.taskAuthority(context);
        if (!widgetLists.isEmpty())
        {
            Cursor cursor = context.getContentResolver().query(
                    TaskLists.getContentUri(authority),
                    new String[] { TaskLists._ID },
                    TaskLists.SYNC_ENABLED + "=1 AND " + TaskLists._ID + " IN (" + TextUtils.join(",", widgetLists) + ")",
                    null,
                    null);
            if (cursor != null)
            {
                while (cursor.moveToNext())
                {
                    writableLists.add(cursor.getLong(0));
                }
                cursor.close();
            }
        }
        Intent editTaskIntent = new Intent(Intent.ACTION_INSERT);
        editTaskIntent.setData(Tasks.getContentUri(authority));
        editTaskIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        if (!writableLists.isEmpty())
        {
            Long preselectList;
            if (writableLists.size() == 1)
            {
                // if there is only one list, then select this one
                preselectList = writableLists.get(0);
            }
            else
            {
                // if there are multiple lists, then select the most recently used
                preselectList = RecentlyUsedLists.getRecentFromList(context, writableLists);
            }
            Log.d(getClass().getSimpleName(), "create task with preselected list " + preselectList);
            ContentSet contentSet = new ContentSet(Tasks.getContentUri(authority));
            contentSet.put(Tasks.LIST_ID, preselectList);
            Bundle extraBundle = new Bundle();
            extraBundle.putParcelable(EditTaskActivity.EXTRA_DATA_CONTENT_SET, contentSet);
            editTaskIntent.putExtra(EditTaskActivity.EXTRA_DATA_BUNDLE, extraBundle);
        }
        context.startActivity(editTaskIntent);
    }
}
 
Example 19
Source File: UpdateWidgetsAction.java    From opentasks with Apache License 2.0 4 votes vote down vote up
private void notifyTaskListDataChanged(AppWidgetManager appWidgetManager, ComponentName componentName)
{
    final int[] appWidgetIds = appWidgetManager.getAppWidgetIds(componentName);
    appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.task_list_widget_lv);
}
 
Example 20
Source File: NoteActivity.java    From writeily-pro with MIT License 4 votes vote down vote up
private void updateWidgets() {
    AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
    int appWidgetIds[] = appWidgetManager.getAppWidgetIds(
            new ComponentName(context, WriteilyWidgetProvider.class));
    appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.widget_notes_list);
}