AndroidプロセスのスレッドIDを出力します

android.os.Looperをインポートします。


Log.e(TAG、 "pid =" + android.os.Process.myPid()+ "tid =" + android.os.Process.myTid());
Log.e(TAG、 "thread id =" + Thread.currentThread()。getId()+ "name =" + Thread.currentThread()。getName());
Log.e(TAG、 "main thread id =" +(Looper.getMainLooper())。getThread()。getId()+ "name =" +(Looper.getMainLooper())。getThread()。getName()) ;

 

Log.e(TAG、 "getTaskId()=" + getTaskId()); //アクティビティ指定务栈的
idLog.e(TAG、 "getApplicationInfo()。uid =" + getApplicationInfo()。uid); // uid 
Log.e(TAG、 "getApplicationInfo()。processName =" + getApplicationInfo()。processName); //プロセス名

 

android.os.Process.myPid():プロセスのIDを取得します。
android.os.Process.myTid():スレッドのIDを取得します。
android.os.Process.myUid():プロセスのユーザーIDを取得します。

 

おすすめ

転載: blog.csdn.net/kv110/article/details/104262071