title: update text of TextView inside current page of ViewPager from Activity
body: <p>I am using ViewPager and Fragment to display data from sqlite. Content for all page is same so I used same Fragment class for all pages. In fragment there is a TextView. And there are two Buttons in Activity. </p>
  
  <p>I am trying to update text of TextView when any Button is clicked from Activity. For this I used <code>interface</code> and override methods in fragment.All works fine.</p>
  
  <p>Note: Buttons are in Activity(common for all pages)</p>
  
  <p><strong>Problem</strong> 
  When I press button it will update textview of next page.  E.g. when I click button in page1 the textview of page2 will be updated and so on.</p>
  
  <p>I used following code. Any help would be appreciate. Thanks.</p>
  
  <p><strong>Fragment</strong> code</p>
  
  <pre><code>@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
      // Create a new TextView and set its text to the fragment's section
      // number argument value.
      View view = inflater.inflate(R.layout.fragmentview, container, false);
      txtAmount = (TextView) view.findViewById(R.id.txtAmount);
  
      return view;
  }
  
  @Override
  public void onPlusClick(String amount) {
      // update textview here
  
  }
  
  @Override
  public void onMinusClick(String amount) {
      // update textview here
  
  }
  </code></pre>
  
  <p><strong>Adapter</strong> code</p>
  
  <pre><code>@Override
      public Fragment getItem(int position) {
          // getItem is called to instantiate the fragment for the given page.
          // Return a DummySectionFragment (defined as a static inner class
          // below) with the page number as its lone argument.
          Fragment fragment = new DummyFragment();
  
          onClick = (onButtonClick) fragment;
  
          return fragment;
      }
  
      @Override
      public int getCount() {
          // Show 3 total pages.
          return arrModel.size();
      }
  
      @Override
      public CharSequence getPageTitle(int position) {
  
          return arrModel.get(position).fname;
      }
  </code></pre>
  
  <p><strong>Activity</strong> code</p>
  
  <pre><code>@Override
  public void onClick(View v) {
      if (v == btnMinus) {
  
          onClick.onMinusClick(edtAmount.getText().toString());
      } else if (v == btnPlus) {
  
          onClick.onPlusClick(edtAmount.getText().toString());
      }
  
  }
  </code></pre>