如何传递一个额外的使用MonkeyRunner一个Android意图是什么? [英] How can I pass an Extra to an Android intent using MonkeyRunner?

查看:124
本文介绍了如何传递一个额外的使用MonkeyRunner一个Android意图是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想测试使用 MonkeyRunner 工具我的应用程序。我想一个额外添加到我的活动。 - Python脚本的执行没有错误:

I am trying to test my app using the MonkeyRunner tool. I am trying to add an EXTRA to my activity. The python script executes without error:

device = MonkeyRunner.waitForConnection()
device.wake()
extra = {'MY_EXTRA', True}
device.startActivity(component="org.mycompany.myapp/.activity.Show",extras=extra)

但是,当我检查的目的在我的应用程序,我没有得到的值传递:

But when I inspect the intent in my app I do not get the value passed:

boolean myExtra = i.getBooleanExtra("MY_EXTRA", false);

我在想什么?难道我传递的意图错了吗?难道我检查的价值在Android应用程序错了吗?

What am I missing? Am I passing in the intent wrong? Am I inspecting the value in the Android app wrong?

推荐答案

这是 MonkeyRunner 的错误。它不正确处理传递布尔成演员。如果你传递一个字符串,而不是,它应该工作。

This is a bug in MonkeyRunner. It is not correctly handling passing boolean into extras. If you pass a string instead, it should work.

修复此问题。

这篇关于如何传递一个额外的使用MonkeyRunner一个Android意图是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆