Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class StockWidgetProvider extends AppWidgetProvider {
- public static final String CHART_LINK = "callback_URL";
- protected static final String JSON_RETRIEVED = "json_retrieved";
- Context theContext;
- @SuppressWarnings("deprecation")
- @Override
- public void onUpdate(Context ctxt, AppWidgetManager appWidgetManager,
- int[] appWidgetIds) {
- Log.d(this.getClass().getName(), "onUpdate called.");
- for (int i = 0; i < appWidgetIds.length; i++) {
- Log.d(this.getClass().getName(), "Updating Widget: " + i);
- Intent svcIntent = new Intent(ctxt, StockWidgetService.class);
- svcIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
- appWidgetIds[i]);
- svcIntent.setData(Uri.parse(svcIntent
- .toUri(Intent.URI_INTENT_SCHEME)));
- RemoteViews widget = new RemoteViews(ctxt.getPackageName(),
- R.layout.trending_item);
- widget.setRemoteAdapter(appWidgetIds[i], R.id.favorite_listview,
- svcIntent);
- Intent browserIntent = new Intent(Intent.ACTION_VIEW,
- Uri.parse("http://www.google.com"));
- PendingIntent clickPI = PendingIntent.getActivity(ctxt, 0,
- browserIntent, PendingIntent.FLAG_UPDATE_CURRENT);
- widget.setPendingIntentTemplate(R.id.favorite_listview, clickPI);
- appWidgetManager.updateAppWidget(appWidgetIds[i], widget);
- }
- super.onUpdate(ctxt, appWidgetManager, appWidgetIds);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement