I am trying to change the ImageButton source in android inside a fragment.
I want to use the Image.setImageResource () method, however I cannot use getResources () inside the fragment. is there any way around this? getActivity (). getResources () does not return any results, unfortunately.
I tried writing a string such as "R.drawable". + {different image names}, but I cannot convert this string to int.
How else can this be done?
I just want to change some image buttons with source files depending on different things.
source share