Android Open Source - Tip_Calculator Widget Provider






From Project

Back to project page Tip_Calculator.

License

The source code is released under:

Apache License

If you think the Android project Tip_Calculator 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.collinguarino.tipcalculator;
/*from   www.j  ava  2  s. c  o  m*/
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.widget.RemoteViews;

/**
 * Created by collinux on 7/23/14.
 */
public class WidgetProvider extends AppWidgetProvider {

    @Override
    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
        super.onUpdate(context, appWidgetManager, appWidgetIds);

        Intent intent = new Intent(context, ActivityMain.class);
        PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);

        RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_layout);
        views.setOnClickPendingIntent(R.id.widgetView, pendingIntent);
        appWidgetManager.updateAppWidget(appWidgetIds, views);
    }
}




Java Source Code List

com.collinguarino.tipcalculator.ActivityMain.java
com.collinguarino.tipcalculator.ActivityPreferences.java
com.collinguarino.tipcalculator.ApplicationTest.java
com.collinguarino.tipcalculator.CleanEditText.java
com.collinguarino.tipcalculator.TipCalculatorDashClock.java
com.collinguarino.tipcalculator.WidgetProvider.java