Android Open Source - garageoPIner-androidApp My Time Trigger Widget Provider

From Project

Back to project page garageoPIner-androidApp.


The source code is released under:

Apache License

If you think the Android project garageoPIner-androidApp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.wirthual.garageopiner.utils;
//  w  w w  . j  a v a2  s .  co m
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.widget.RemoteViews;

import com.wirthual.garageopiner.R;
import com.wirthual.garageopiner.activities.SettingsActivity;

public class MyTimeTriggerWidgetProvider extends AppWidgetProvider {

  int totalTime = 60;
  public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
        final int N = appWidgetIds.length;
        // Perform this loop procedure for each App Widget that belongs to this provider
        for (int i=0; i<N; i++) {
            int appWidgetId = appWidgetIds[i];

            // Create an Intent to launch ExampleActivity
            Intent intent = new Intent(context, SettingsActivity.class);
            PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);

            // Get the layout for the App Widget and attach an on-click listener
            // to the button
            RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_trigger_layout);
            views.setOnClickPendingIntent(, pendingIntent);
            //views.setCharSequence(, "setText", "T");

            // Tell the AppWidgetManager to perform an update on the current app widget
            appWidgetManager.updateAppWidget(appWidgetId, views);

Java Source Code List