I am aware that using Context
and a method getClass().getName()
I can get a string which represent full class name, like com.package1.package2.MainActivity
.
How can I get only the last part, class name only? In this case it would be MainActivity
string.
I can do it with a simple split()
method, but maybe there is a better way, more reliable.