title: How to update widget views instantly when button clicked
body: <p>I've seen a lot of answer here, none of them worked..! I just want a textview to get updated instantly once I click a button next to it.! I've tried to print a toast message and it shows normally, but updating views is the problem.</p>
  
  <p><strong>My Code</strong></p>
  
  <pre><code>public class FollowersWidget extends AppWidgetProvider {
  
    public static String REFRESH_ACTION = "android.appwidget.action.APPWIDGET_UPDATE";
  
    int x = 0;
  
    @Override
    public void onReceive(Context context, Intent intent) {
      super.onReceive(context, intent); 
  
      if (intent.getAction().equals(REFRESH_ACTION)) {
        AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
        final RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.followers_widget);
  
        x++;
        views.setTextViewText(R.id.textv_count, x + "");
  
        int[] appWidgetId = AppWidgetManager.getInstance(context).getAppWidgetIds(new ComponentName(context, FollowersWidget.class));
        appWidgetManager.updateAppWidget(appWidgetId, views); 
      }
  
    }
  
    static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
        int appWidgetId) {
  
      RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.followers_widget);
  
      try {
  
        String count = MyConfigureActivity.getNumCount(context, appWidgetId);
        views.setTextViewText(R.id.textv_count, count );
  
        views.setOnClickPendingIntent(R.id.refreshButton,getRefreshPendingIntent(context, appWidgetId));
  
      } catch (Exception e) {
        e.printStackTrace();
      }
  
      appWidgetManager.updateAppWidget(appWidgetId, views);
    }
  
    public static PendingIntent getRefreshPendingIntent(Context context, int appWidgetId) {
      Intent intent = new Intent(REFRESH_ACTION);
      intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
      return PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    }
  
  // other widget methods..
  ..
  .
  }
  </code></pre>
  
  <p><strong>My Manifest</strong> </p>
  
  <pre><code>  &lt;receiver android:name=".FollowersWidget"&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/followers_info"/&gt;
      &lt;/receiver&gt;
  </code></pre>