2014-11-06 67 views
0

當我在命令行上運行它時,它將調出設備上的屏幕來更改語言。如何將ADB命令行控件--->轉換爲MonkeyRunner Python腳本

$ adb shell am start -a android.settings.LOCALE_SETTINGS 

很好用。

我正在嘗試monkeyrunner所調用的Python腳本中的相同功能。 如何將上述內容翻譯成可與monkeyrunner/python一起使用的內容?

例如我試過了:

device = Monkeyrunner.waitForConnection() 
package = 'android.settings' 
activity = 'LOCALE_SETTINGS' 
runComponent = package + '/' activity 

device.startActivity(component=runComponent 

這什麼都沒做。沒有錯誤信息。但沒有。

有什麼建議嗎?

回答

1

android.settings.LOCALE_SETTINGS不是component而是action。你可以做任何

device.startActivity(action='android.settings.LOCALE_SETTINGS') 

device.startActivity(component='com.android.settings/com.android.settings.Settings$LocalePickerActivity') 
+0

工作!謝謝。在genereal中,我如何通過device.startActivity來發布命令?對於我所能做的所有事情,我確實找不到任何文件......重要的是......如何做這些事情。 – superstar3000 2014-11-06 19:51:33

+0

提問具體問題會更有成效。問題越廣泛 - 無法回答的機會就越高。 – 2014-11-07 20:01:31