当前位置: 首页>>代码示例>>Java>>正文


Java AppWidgetManager.getInstance方法代码示例

本文整理汇总了Java中android.appwidget.AppWidgetManager.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java AppWidgetManager.getInstance方法的具体用法?Java AppWidgetManager.getInstance怎么用?Java AppWidgetManager.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.appwidget.AppWidgetManager的用法示例。


在下文中一共展示了AppWidgetManager.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onReceive

import android.appwidget.AppWidgetManager; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    AppWidgetManager mgr = AppWidgetManager.getInstance(context);
    if (intent.getAction().equals(WIDGET_ACTION)) {
        int appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
                AppWidgetManager.INVALID_APPWIDGET_ID);
        int viewIndex = intent.getIntExtra(EXTRA_ITEM, 0);

        List<Hit> mWidgetItems = CanvasDownloadTable.getRows(context.getContentResolver().query(CanvasDownloadTable.CONTENT_URI, null, null, null, null), true);
        Intent intent_detail = new Intent(context, PicDetail.class);
        intent_detail.putExtra(PicDetail.EXTRA_PIC, mWidgetItems.get(viewIndex));
        intent_detail.putExtra(PicDetail.origin,context.getResources().getString(R.string.widget));
        intent_detail.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent_detail);
    }
    super.onReceive(context, intent);
}
 
开发者ID:MuditSrivastava,项目名称:Canvas-Vision,代码行数:18,代码来源:StackWidgetProvider.java

示例2: onReceive

import android.appwidget.AppWidgetManager; //导入方法依赖的package包/类
@Override
public void onReceive(final Context context, Intent widgetIntent) {
    final String action = widgetIntent.getAction();

    if (REFRESH_ACTION.equals(action)) {
        LOGD(TAG, "received REFRESH_ACTION from widget");
        final boolean shouldSync = widgetIntent.getBooleanExtra(EXTRA_PERFORM_SYNC, false);

        // Trigger sync
        Account chosenAccount = AccountUtils.getActiveAccount(context);
        if (shouldSync && chosenAccount != null) {
            SyncHelper.requestManualSync(chosenAccount);
        }

        // Notify the widget that the list view needs to be updated.
        final AppWidgetManager mgr = AppWidgetManager.getInstance(context);
        final ComponentName cn = new ComponentName(context, ScheduleWidgetProvider.class);
        mgr.notifyAppWidgetViewDataChanged(mgr.getAppWidgetIds(cn),
                R.id.widget_schedule_list);

    }
    super.onReceive(context, widgetIntent);
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:24,代码来源:ScheduleWidgetProvider.java

示例3: pushUpdate

import android.appwidget.AppWidgetManager; //导入方法依赖的package包/类
private void pushUpdate(Context context, int[] appWidgetIds, RemoteViews views) {
    // Update specific list of appWidgetIds if given, otherwise default to all
    final AppWidgetManager gm = AppWidgetManager.getInstance(context);
    if (appWidgetIds != null) {
        gm.updateAppWidget(appWidgetIds, views);
    } else {
        gm.updateAppWidget(new ComponentName(context, this.getClass()), views);
    }
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:10,代码来源:MusicXwidget4x4.java

示例4: pushUpdate

import android.appwidget.AppWidgetManager; //导入方法依赖的package包/类
private void pushUpdate(Context context, int[] appWidgetIds,
                        RemoteViews views) {
    // Update specific list of appWidgetIds if given, otherwise default to
    // all
    final AppWidgetManager gm = AppWidgetManager.getInstance(context);
    if (appWidgetIds != null) {
        gm.updateAppWidget(appWidgetIds, views);
    } else {
        gm.updateAppWidget(new ComponentName(context, this.getClass()),
                views);
    }
}
 
开发者ID:89luca89,项目名称:ThunderMusic,代码行数:13,代码来源:MediaAppWidgetProvider2x1.java

示例5: update

import android.appwidget.AppWidgetManager; //导入方法依赖的package包/类
/**
 * Updates the AppWidget after the ImageView has loaded the Bitmap.
 */
private void update() {
  AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(this.context);
  if (this.componentName != null) {
    appWidgetManager.updateAppWidget(this.componentName, this.remoteViews);
  } else {
    appWidgetManager.updateAppWidget(this.widgetIds, this.remoteViews);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:AppWidgetTarget.java

示例6: onReceive

import android.appwidget.AppWidgetManager; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    super.onReceive(context, intent);
    if (intent.getAction().equals(ACTION_DATA_UPDATED)) {
        AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
        int[] appWidgetIds = appWidgetManager.getAppWidgetIds(
                new ComponentName(context, getClass()));
        appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.widget_list);
    }
}
 
开发者ID:mvescovo,项目名称:item-reaper,代码行数:11,代码来源:ItemWidgetProvider.java

示例7: updateWidget

import android.appwidget.AppWidgetManager; //导入方法依赖的package包/类
public void updateWidget() {
    Intent intent = new Intent(this, BuddyBookWidgetProvider.class);
    intent.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
    // Use an array and EXTRA_APPWIDGET_IDS instead of AppWidgetManager.EXTRA_APPWIDGET_ID,
    // since it seems the onUpdate() is only fired on that:
    AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(mContext);
    int appWidgetIds[] = appWidgetManager
            .getAppWidgetIds(new ComponentName(mContext, BuddyBookWidgetProvider.class));

    intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds);

    sendBroadcast(intent);
}
 
开发者ID:victoraldir,项目名称:BuddyBook,代码行数:14,代码来源:MainActivity.java

示例8: pushUpdate

import android.appwidget.AppWidgetManager; //导入方法依赖的package包/类
private void pushUpdate(final Context context, final int[] appWidgetIds, final RemoteViews views) {
    final AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
    if (appWidgetIds != null) {
        appWidgetManager.updateAppWidget(appWidgetIds, views);
    } else {
        appWidgetManager.updateAppWidget(new ComponentName(context, getClass()), views);
    }
}
 
开发者ID:aliumujib,项目名称:Orin,代码行数:9,代码来源:AppWidgetBig.java

示例9: hasInstances

import android.appwidget.AppWidgetManager; //导入方法依赖的package包/类
/**
 * Check against {@link AppWidgetManager} if there are any instances of this
 * widget.
 */
private boolean hasInstances(Context context) {
    AppWidgetManager appWidgetManager = AppWidgetManager
            .getInstance(context);
    int[] appWidgetIds = appWidgetManager
            .getAppWidgetIds(new ComponentName(context, this.getClass()));
    return (appWidgetIds.length > 0);
}
 
开发者ID:89luca89,项目名称:ThunderMusic,代码行数:12,代码来源:MediaAppWidgetProvider4x2_Light.java

示例10: onReceive

import android.appwidget.AppWidgetManager; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    super.onReceive(context, intent);
    int[] appWidgetIDs;
    if (intent.getAction().equals(ACTION_UPDATE)) {
        AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
        appWidgetIDs = appWidgetManager.getAppWidgetIds(new ComponentName(context, getClass()));
        appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIDs, R.id.newsList);
    }
}
 
开发者ID:vikasdesale,项目名称:News24x7-news-from-every-part-of-the-world,代码行数:11,代码来源:NewsWidgetProvider.java

示例11: hasInstances

import android.appwidget.AppWidgetManager; //导入方法依赖的package包/类
private boolean hasInstances(Context context) {
    AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
    int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, this.getClass()));
    return (appWidgetIds.length > 0);
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:6,代码来源:MusicXwidget4x4.java

示例12: PingAsyncTask

import android.appwidget.AppWidgetManager; //导入方法依赖的package包/类
public PingAsyncTask(Context appContext, int widgetId) {

        mAppContext = appContext;
        mWidgetId = widgetId;
        mAppWidgetManager = AppWidgetManager.getInstance(appContext);
    }
 
开发者ID:abicelis,项目名称:PingWidget,代码行数:7,代码来源:PingAsyncTask.java

示例13: AppWidgetManagerCompat

import android.appwidget.AppWidgetManager; //导入方法依赖的package包/类
AppWidgetManagerCompat(Context context) {
    mContext = context;
    mAppWidgetManager = AppWidgetManager.getInstance(context);
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:5,代码来源:AppWidgetManagerCompat.java

示例14: findAppWidgetIds

import android.appwidget.AppWidgetManager; //导入方法依赖的package包/类
private static int[] findAppWidgetIds(Context context) {
    AppWidgetManager manager = AppWidgetManager.getInstance(context);
    ComponentName widget = new ComponentName(context, RecordingWidgetProvider.class);
    return manager.getAppWidgetIds(widget);

}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:7,代码来源:WidgetHelper.java

示例15: handleActionUpdateWidgets

import android.appwidget.AppWidgetManager; //导入方法依赖的package包/类
private void handleActionUpdateWidgets(Recipe recipe) {
    AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(this);
    int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(this, RecipeWidgetProvider.class));
    RecipeWidgetProvider.updateRecipeWidgets(this, appWidgetManager, recipe, appWidgetIds);
}
 
开发者ID:twisstosin,项目名称:UdacityBakingAndroid,代码行数:6,代码来源:RecipeWidgetService.java


注:本文中的android.appwidget.AppWidgetManager.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。