Halil ONCEN Halil ONCEN - 3 years ago 200
Android Question

How can I add methods that I often use to android studio?

For example,

public void show_message(String message){
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
}


I want this method add auto Activity.java when create new activity or java class.

I want to save different methods like this and include it in the my project quickly where it is needed.

Answer Source

You just need to make a Common Utilities class. Just copy and paste the class in whatever project you are using it. Just make its method access specifiers as public staic so that you can easily access it. For e.g.

CommonUtilities.showToastMessage(String text);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download