I have a ViewPager with 3 fragments. One fragment downloads data from a website and displays it in TextViews. Now when the user clicks in the menu of the MainActivity on the item "refresh", the fragment should redownloads the data and displays it. I tried to create a function refresh in the fragment's class and call it from the MainActivity's menu. That worked, but then it crashes because the app can't find the textview. The variable view is empty and it causes a null pointer exception.
What can I do to resolve this?
Many thanks!
From your fragmentactivity,
where string is the tag. You set the tag of the fragments in the add, replace, etc methods.
Once you have your fragment, you can do