I have a ViewPager in my main Activity and make a TextView on every page.
@Override
public Object instantiateItem(View collection, int counterID) {
TextView counter = new TextView(cxt);
((ViewPager) collection).addView(counter, 0);
return counter;
}
TextView shows counter value and I want to change it on active page (TextView text) using the method I implemented in the same Activity with PagerAdapter.
Is there any way to access TextView on specific page outside of PagerAdapter (in the same Activity) and change its attributes?
You can set an ID to the TextView by calling
Then you can find your view by
(TextView) findViewById(int id)or you can set a Tag on the textview:
textview.setId(Object tag);and find the view via(TextView) findViewWithTag (Object tag)