Tuesday, October 18, 2011

Android, Get the Process ID and Thread ID

When you debug the Multi-Thread app in android, it will be better that you can tell the activity thread id. so I have one Simple Line of Code to dumpout the logcat message, time, processid, thread id and the message.

public static void MLog(String msg) {
        Log.d("xxxnew", String.format("at %s Process ID %s, Thread ID %s %s   ", new Date().toString(),  Process.myPid(),Process.myTid(),msg));


No comments:

Locations of visitors to this page