MessengerServiceActivities.java is the file in android sample.
Locate in C:\android-sdk-windows\samples\android-8\ApiDemos\src\com\example\android\apis\app\ dir.I add myPid() and myTid() in onCreate(), then i set a breakpoint at code System.out. I find pid and tid are the same value. I know the process id and thread id should not be the same in windows, Why myPid() and myTid() return the same value in android? protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
int pid;
int tid;
pid = android.os.Process.myPid();
tid = android.os.Process.myTid();
System.out.println(pid +" "+ tid);
setContentView(R.layout.messenger_service_binding);
Locate in C:\android-sdk-windows\samples\android-8\ApiDemos\src\com\example\android\apis\app\ dir.I add myPid() and myTid() in onCreate(), then i set a breakpoint at code System.out. I find pid and tid are the same value. I know the process id and thread id should not be the same in windows, Why myPid() and myTid() return the same value in android? protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
int pid;
int tid;
pid = android.os.Process.myPid();
tid = android.os.Process.myTid();
System.out.println(pid +" "+ tid);
setContentView(R.layout.messenger_service_binding);
myTid():Returns the identifier of the calling threadThis process contains only one main thread,so myPid() == myTid()