/**
* 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. 为DBNavigator的按钮加中文

    转自:http://hi.baidu.com/debiansir/item/0699f5b6bb4d99f063388e71 /*Delphi中数据库控件DBNavigator使用起来不错,但是按钮上 ...

  2. elastic search 重要的系统配置

    文章翻译自 https://www.elastic.co/guide/en/elasticsearch/reference/current/file-descriptors.html 1.文件描述符 ...

  3. teamview修改id

     怎么修改 TeamViewer ID 呢?按照下列的操作步骤,就能很简单的改变TeamViewer的id哦!1. 开始 > 运行,录入%appdata%,删除TeamViewer的文件夹: ...

  4. np.newaxis

    http://blog.csdn.net/mameng1/article/details/54599306

  5. java特殊抽象类-接口

  6. SpringBoot(三)thymeleaf+JPA+MySql

    接着上一节的 第一步:在pom文件中加入以下代码: <!--JPA--> <dependency> <groupId>org.springframework.boo ...

  7. 蓝牙协议分析(6)_BLE地址类型

    1. 前言 也许关注BLE的同学都注意到了,BLE设备有多种类型的设备地址,如Public Device Address.Random Device Address.Static Device Add ...

  8. 剑指Offer 49. 把字符串转换成整数 (字符串)

    题目描述 将一个字符串转换成一个整数(实现Integer.valueOf(string)的功能,但是string不符合数字要求时返回0),要求不能使用字符串转换整数的库函数. 数值为0或者字符串不是一 ...

  9. SpringBoot的学习【2.分析HelloWorld的依赖】

    1.分析引入的父类项目 引入的父类如下. 点击进去发现又引入了一个父类 点击进去发现是spring的版本控制和相应的依赖. so~这就是springboot的终极大包.想用springboot开发的时 ...

  10. Js强制转换

    Js强制转换 ParseInt(a,b):整型 只能放字符串,b为基数.声明前面的数是几进制.因为只能放字符串,所以无论放什么都转换为字符串: 如果String以0x开头则为16进制的整数: ‘036 ...