Unique id of an android activity

前端 未结 5 1193
渐次进展
渐次进展 2021-01-13 00:07

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

5条回答
  •  囚心锁ツ
    2021-01-13 00:52

    every where in your project :

        MainActivity.class.hashCode(); 
    

    in Activity

        this.hashCode();
    

    You can even get hashCode from context

提交回复
热议问题