I have an application which needs to find the user location, and location is fetched in various classes, so i have written a separate class(Not an Activity
probably you can create a class that extends Activity (AppCompactActivity is better), implement all needed location code and extends with this class all activities where you need to use it.