I have a base class for my all of activities (ActivityBase
) that itself derives from android.app.Activity
. In onCreate I want to execute some conditio
On some occasions simply this line in the parent class solves this problem. It returns the name of the "child" class (not the parent):
this.getClass().getName() //String like "com.mycompany.myclassname"
this.getClass().getSimpleName() //String like "myclassname"
See here for further discussion: http://www.coderanch.com/t/324715/java/java/Getting-child-class-name-parent