title: How to open a specific Fragment when clicking on a home screen widget
body: <p>How to open a specific Fragment when clicking on a home screen widget, I can already open an Activity but I have no idea about how to open a fragment from a widget this is my widget class</p>
  
  <pre><code>public class MyWidget extends AppWidgetProvider {
  ComponentName watchWidget;
  RemoteViews remoteViews;
  private static final String SYNC_CLICKED = "automaticWidgetSyncButtonClick";
  
  void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
                       int appWidgetId) {
  
  
  
      remoteViews = new RemoteViews(context.getPackageName(), R.layout.My_widgets);
      watchWidget = new ComponentName(context, MyWidget.class);
      remoteViews.setTextViewText(R.id.appwidget_text,"Widget Example");
      // start Activity from the widget
  
      Intent configIntent = new Intent(context, MainActivity.class);
      PendingIntent configPendingIntent = PendingIntent.getActivity(context, 0, configIntent, 0);
      remoteViews.setOnClickPendingIntent(R.id.widget_container, configPendingIntent);
      appWidgetManager.updateAppWidget(watchWidget, remoteViews);
  }
  </code></pre>
  
  <p>So any idea?</p>