Instead of writing getClass().getName() in every place where the log is placed in a specific activity, it is always preferable to have a TAG that will represent the name of the activity class.
Why use TAG?
When you run the application, it can have more than one Activity class. To distinguish which activity class has logged information, we use TAG , which of course represents the name of the class.
And the correct way (I'm not saying that you spelled incorrectly) about writing TAG:
private static final String TAG = TasksSample.class.getSimpleName(); // and not "TasksSample"
source share