getting only name of the class Class.getName()

Viewed 119883

How can i get the name of the class

String.class.getName()  returns java.lang.String


I am only interested in getting last part ie only String
Any Api can do that?

7 Answers

Here is the Groovy way of accessing object properties:

this.class.simpleName    # returns the simple name of the current class

Get simple name instead of path.

String onlyClassName =  this.getLocalClassName(); 

call above method in onCreate

Related