I have an activity with a global variable int x, how can a fragment get the current value of variable x of its activity ?
Either set the var as public static, or use
public static
((MyActivity)getActivity()).getX()
1.4m articles
1.4m replys
5 comments
56.9k users