adb 传送 intent boolean extra value
来源:互联网 发布:linux配置gradle 编辑:程序博客网 时间:2024/06/18 10:33
最近想用命令行给 0xBench 发送 intent extra, 命令行如下:
adb shell am start -n org.zeroxlab.zeroxbenchmark/.Benchmark -ez autorun true
adb 命令 help 提示的就是用
--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE>
0xBench 中 org.zeroxlab.zeroxbenchmark.Benchmark.java 中接收 intent 的代码如下:
Intent intent = getIntent(); Bundle bundle = intent.getExtras(); if (bundle != null) { mAutoRun = bundle.getBoolean("autorun"); mCheckMath = bundle.getBoolean("math");
...
}
我加入了一些 log, 结果让我非常吃惊
bundle.get("autorun") 的结果是: z (注意它把 -ez 认为是 -e z 了, 与adb help说明不符合)
而autorun是:null
把命令行改为
adb shell am start -n org.zeroxlab.zeroxbenchmark/.Benchmark -e autorun true
这次autorun是 "true", 注意是 String value, 而
mAutoRun = bundle.getBoolean("autorun");得到的结果还是 false
我想以后只有改0xBench源代码, 用 Boolean.valueOf() 把它矫正过来了
最后发现还是自己粗心的毛病
应该用 --ez, 而不是 -ez
- adb 传送 intent boolean extra value
- ScheduledThreadPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(boolean value)
- Intent传送对象
- 【intent extra】Android Activity直接传递数据
- 【Android】Intent中使用Extra传递数据
- Intent传递extra data,小心坑!
- Bundle&Intent&for&List&Map&Extra
- BroadcastReceiver获取不到Intent的Extra
- Android Intent Action,Category,Data,Extra,Flag
- Intent如何传送List<Map<?,?>>
- Android---Intent传送复杂数据
- Extra
- Ext.isEmpty( Mixed value, [Boolean allowBlank] ) 用法
- Ext.isEmpty( Mixed value, [Boolean allowBlank] ) 用法
- Ext.isEmpty( Mixed value, [Boolean allowBlank] ) 用法
- Notification内的Intent Extra数据不能更新的问题
- Notification内的Intent Extra数据不能更新的问题
- Notification内的Intent Extra数据不能更新的问题
- 数据挖掘步骤
- ORACLE坏块总结
- Python中的greelet模块的线程安全问题 ( by quqi99 )
- TCP/IP - 2.3 使用协议族的函数表初始化socket
- not-null property references a null or transient value:
- adb 传送 intent boolean extra value
- VS2008如何将变量和控件相关联
- TCP/IP - 2.4 分配并初始化sock结构
- 转,yum第三方源
- Git 笔记
- Java谜题畅读版之更多的类谜题
- TCP/IP - 2.5 TCP协议对sock结构初始化
- Web 服务器被配置为不列出此目录的内容。??
- window.location.href/replace/reload()--页面跳转+替换+刷新