You can create one BaseActivity
and extend this BaseActivity
to all the activities.
Now you can write some important code in BaseActivity
which can be helpful in all the Activities. This way you don't need to write similar code in All the activities and it will create Base Structure for your project which can be useful to you in future.
Or
You can write one method in Utils
class and call that method from every activities, by this way you need to create method only once, but have to call from every activities when needed.
e.g.
//Creating method in util class
public class Utils{
public static void addLog(String params, ...){
/* Your code goes here... */
}
}
//calling from activities
Utils.addLog(params...);