@Override
 protected void onCreate(Bundle savedInstanceState) {
   mAppWidgetId = getIntent().getIntExtra(MainWidgetProvider.EXTRA_WIDGET_ID, 0);
   Intent i = getIntent();
   i.putExtra(FRAGMENT, MainWidgetSettingsFragment.class);
   i.putExtra(GenericModelDetailFragment.ARG_ITEM, (Parcelable) Settings.WIDGET);
   setIntent(i);
   super.onCreate(savedInstanceState);
   if (getSupportActionBar() != null) {
     getSupportActionBar().setDisplayHomeAsUpEnabled(false);
   }
   if (!backstack.isEmpty()) {
     ((MainWidgetSettingsFragment) backstack.get(0)).setup(mAppWidgetId);
   }
 }
 @SuppressLint("NewApi")
 @Override
 protected void onPause() {
   super.onPause();
   Log.d("WIDGET", "updated");
   final Intent intent = new Intent(this, MainWidgetProvider.class);
   intent.setAction("android.appwidget.action.APPWIDGET_UPDATE");
   // Use an array and EXTRA_APPWIDGET_IDS instead of
   // AppWidgetManager.EXTRA_APPWIDGET_ID,
   // since it seems the onUpdate() is only fired on that:
   intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, new int[] {mAppWidgetId});
   AppWidgetManager.getInstance(this)
       .notifyAppWidgetViewDataChanged(mAppWidgetId, R.id.widget_tasks_list);
   sendBroadcast(intent);
   // Finish this activity
   finish();
 }