I need to get an unique id of an android activity instance. I\'d like to take the string which the activitymanager writes in the log (for example: ActivityManager: Activity
I know this question is a bit outdated, but i needed this for some reasons.
It is NOT a good idea to use the hashCode method of the activity, if you want to keep it for longer. As we all know, Activities can be cleaned up by the Operating System. This means, that when they get recreated, they probably have a different hashCode than the instance before. A solution for this (if you want to stay with an integer as id) could be the getIntent().hashCode()