title: How add app widget provider class
body: <p><a href="https://developer.android.com/guide/topics/appwidgets/index.html" rel="nofollow">https://developer.android.com/guide/topics/appwidgets/index.html</a></p>
  
  <p>It explains how to declare it in Manifest:</p>
  
  <blockquote>
  <pre><code>&lt;receiver android:name="ExampleAppWidgetProvider" &gt;
  &lt;intent-filter&gt;
      &lt;action android:name="android.appwidget.action.APPWIDGET_UPDATE" /&gt;
  &lt;/intent-filter&gt;
  &lt;meta-data android:name="android.appwidget.provider"
             android:resource="@xml/example_appwidget_info" /&gt; &lt;/receiver&gt;
  </code></pre>
  </blockquote>
  
  <p>And later it says how to add class:</p>
  
  <blockquote>
    <p>public class ExampleAppWidgetProvider extends AppWidgetProvider {</p>
  
  <pre><code>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&lt;N; i++) {
          int appWidgetId = appWidgetIds[i];
  
          // Create an Intent to launch ExampleActivity
          Intent intent = new Intent(context, ExampleActivity.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.appwidget_provider_layout);
          views.setOnClickPendingIntent(R.id.button, pendingIntent);
  
          // Tell the AppWidgetManager to perform an update on the current app widget
          appWidgetManager.updateAppWidget(appWidgetId, views);
      }
  } }
  </code></pre>
  </blockquote>
  
  <p>And it says I need to declare the class as a broadcast receiver.</p>
  
  <p>So My question is: I have the receiver in my app, but how do I add the class and declare it as a <strong><em>broadcast</em></strong> receiver?
  It would be helpful if someone posted an example code of receiver with class, so I know how to put it together.
  I'm sorry if this is a stupid question, I'm just new to this all.</p>