/**
* Returns the identifier of this process's user.
* 返回此进程的用户的标识符。
*/
Log.e(TAG, "Process.myUid() = " + android.os.Process.myTid()); /**
* Returns the identifier of this process, which can be used with
* killProcess and sendSignal.
* 返回此进程的标识符,可用于进程和发送信号。
*/
Log.e(TAG, "Process.myPid() = " + android.os.Process.myPid()); /**
* Returns the identifier of the calling thread, which be used with
* setThreadPriority(int, int).
* 返回调用线程的标识符,该标识符与StTeRead优先级(int,int)。
*/
Log.e(TAG, "Process.myTid() = " + android.os.Process.myTid()); /**
* Returns the thread's identifier. The ID is a positive long generated
* on thread creation, is unique to the thread, and doesn't change
* during the lifetime of the thread; the ID may be reused after the
* thread has been terminated.
* 返回线程的标识符。ID是正长生成的关于线程创建,对于线程是唯一的,并且不会改变。
* 在线程的生存期内,ID可以在线程已被终止。
*/ //返回当前线程的id
Log.e(TAG, "Thread.currentThread().getId() = "
+ Thread.currentThread().getId());
//返回主线程的id
Log.e(TAG, "getMainLooper().getThread().getId() = "
+ getMainLooper().getThread().getId()); //返回当前应用的主线程id
Log.e(TAG,
"((getApplication().getMainLooper()).getThread()).getId() = "
+ ((getApplication().getMainLooper()).getThread())
.getId()); /**
* Return the identifier of the task this activity is in. This
* identifier will remain the same for the lifetime of the activity.
* 返回此活动正在执行的任务的标识符。这个标识符对于活动的生存期将保持不变。
*/
//返回activity任务栈的id
Log.e(TAG, "getTaskId() = " + getTaskId()); /**
* The kernel user-ID that has been assigned to this application;
* currently this is not a unique ID (multiple applications can have the
* same uid).
* 已分配给该应用程序的内核用户ID;这不是一个唯一的ID(多个应用程序可以有相同的UID)。
*/
Log.e(TAG, "getApplicationInfo().uid = " + getApplicationInfo().uid); /**
* The name of the process this application should run in. From the
* "process" attribute or, if not set, the same as packageName.
* 此应用程序应运行的进程的名称。从“进程”属性,或如果没有设置,与PACKAGEName相同。
*/
Log.e(TAG, "getApplicationInfo().processName = "
+ getApplicationInfo().processName); /**
* 得到当前activity的信息
*/
Log.e(TAG, "Activity.toString:"+this.toString()); new Thread(new Runnable() { @Override
public void run() {
//返回当前线程的id
// TODO Auto-generated method stub
Log.e(TAG, "Thread.currentThread().getId() = "
+ Thread.currentThread().getId());
}
}).start();
 

结果:

2018-08-28 15:00:42.887 29813-29813/com.example.user.demo E/EventBusDemoActivity: Process.myUid() = 29813
2018-08-28 15:00:42.887 29813-29813/com.example.user.demo E/EventBusDemoActivity: Process.myPid() = 29813
2018-08-28 15:00:42.887 29813-29813/com.example.user.demo E/EventBusDemoActivity: Process.myTid() = 29813
2018-08-28 15:00:42.888 29813-29813/com.example.user.demo E/EventBusDemoActivity: Thread.currentThread().getId() = 1
2018-08-28 15:00:42.888 29813-29813/com.example.user.demo E/EventBusDemoActivity: getMainLooper().getThread().getId() = 1
2018-08-28 15:00:42.888 29813-29813/com.example.user.demo E/EventBusDemoActivity: ((getApplication().getMainLooper()).getThread()).getId() = 1
2018-08-28 15:00:42.888 29813-29813/com.example.user.demo E/EventBusDemoActivity: getTaskId() = 113
2018-08-28 15:00:42.888 29813-29813/com.example.user.demo E/EventBusDemoActivity: getApplicationInfo().uid = 10085
2018-08-28 15:00:42.888 29813-29813/com.example.user.demo E/EventBusDemoActivity: getApplicationInfo().processName = com.example.user.demo
2018-08-28 15:00:42.888 29813-29813/com.example.user.demo E/EventBusDemoActivity: Activity.toString:com.example.user.demo.EventBusDemoActivity$1@d500b7a
2018-08-28 15:00:42.888 29813-29832/com.example.user.demo E/EventBusDemoActivity: Thread.currentThread().getId() = 885

Android 开发 知晓各种id信息 获取线程ID、activityID、内核ID的更多相关文章

  1. android 开发 解码gif图片,获取每帧bitmap

    环境:android 4.3  (注意对于android4.4版本解码出来不正确,除了第一帧正确外,其余的都是显示不同的地方)  通用版本见: android 开发对gif解码(适配android 4 ...

  2. Android开发之多媒体编程之获取图片的副本

    使用BitmapFactory的decodeFile()方法获取的Bitmap对象是只读的,无法进行编辑操作 需要进行编辑的话,需要获取到该对象的一个副本 代码如下: import android.a ...

  3. eclipse android开发,文本编辑xml文件,给控件添加ID后,R.java,不自动的问题。

    直接编辑xml文件给控件添加id,不自动更新.原来的id写法:@id/et_tel 然后改写成这样:@+id/et_tel  然后就好了!操`1

  4. Android开发—已root的手机获取data路径

    开发android的时候,尽管手机已经root但是DDMS中还是没有data/data路径怎么办? 可以用cmd命令提示符为逐个文件夹设置权限: 打开cmd,输入 adb shell  回车—> ...

  5. Android 开发 获取设备信息与App信息

    设备信息 设备ID(DeviceId) 获取办法 android.telephony.TelephonyManager tm = (android.telephony.TelephonyManager ...

  6. android 开发 对图片编码,并生成gif图片

    demo场景: 将2张静态的png格式图片组合生成一个gif图片,间隔500毫秒,关键类:AnimatedGifEncoder 如需要解析gif获取每帧的图片,可参考上一篇博客:<android ...

  7. vue_elementUI_ tree树形控件 获取选中的父节点ID

    el-tree 的 this.$refs.tree.getCheckedKeys() 只可以获取选中的id 无法获取选中的父节点ID想要获取选中父节点的id;需要如下操作1. 找到工程下的node_m ...

  8. Android开发之获取手机SIM卡信息

    TelephonyManager是一个管理手机通话状态.电话网络信息的服务类.该类提供了大量的getXxx(),方法获取电话网络的相关信息. TelephonyManager类概述: 可用于訪问有关设 ...

  9. Android 开发 facebook分享,登陆,获取信息

    1 搭建开发环境    1.1 在Facebook官网SDK中,下载4.0.0的SDK包.        1.2 使用Eclipse导入SDK包中的Facebook工程,并添加android-supp ...

随机推荐

  1. 包的作用域(public、private)

    包的作用域一共有三种情况 修饰符public:标记为public的部分可以被任意的类使用: 修饰符private:标记为private的部分只能被定义他们的类使用: 没有指定修饰符的部分:这部分(类. ...

  2. redis缓存工具类

    import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis ...

  3. 复制目录及其子目录下所有文件DOC

    echo 开始同步代码 set src_home=F:\work\sign\Bonade-Sign set dest_home=F:\work\testGit\sign5\Bonade-Sign se ...

  4. VBS下载者助以一臂之力

    当拿到shell到手,服务器是内网,你又没有条件映射,服务器又穿不上东西 是不是很郁闷,还有我们还有vbs,能执行cmd命令就有希望 一.VBS下载者: 复制代码 代码如下: Set Post = C ...

  5. 网络编程 生产者消费者模型 GiL

    守护进程: 注意事项: 1.必须在p.start()前 2.守护进程不能开子进程 3.如果主进程的运行时间快于子进程,那么就只有主进程的结果,没有守护进程的结果,因为守护进程没有进行完.反之会得到两个 ...

  6. webpack配置(入口出口)

    const path=require('path'); //是node.js的path模块 //单入口,单出口 module.exports={ // 入口文件 entry:{ entry:'./sr ...

  7. Spring boot JPA 用自定义主键策略 生成自定义主键ID

    最近学习Spring boot JPA 学习过程解决的一些问题写成随笔,大家一起成长.这次遇到自定义主键的问题 package javax.persistence; public enum Gener ...

  8. 由于找不到 opencv_world320.dll,无法继续执行代

    首先找到自己软件安装(解压)的路径openCV (安装(解压)目录\opencv\build\x64\vc14\bin) 我的安装(解压)目录是:F:\OpenCV\Three320\opencv\b ...

  9. SpringCloud使用Feign调用服务时,@FeignClient注解无法使用

    关于解决这个问题的理论根源传送门:https://blog.csdn.net/alinyua/article/details/80070890我在这里只提供解决方案 0. 结论和解决方案 Spring ...

  10. 20155208徐子涵 《网络对抗》Exp1 PC平台逆向破解

    20155208徐子涵 <网络对抗>Exp1 PC平台逆向破解 实践目标 本次实践的对象是一个名为pwn1的linux可执行文件. 该程序正常执行流程是:main调用foo函数,foo函数 ...