src=<android-sdk-dir>/extras/android/support/v4/src
これでソースが見れるようになる。
from com.android.monkeyrunner import ( MonkeyRunner, MonkeyDevice, MonkeyImage ) import time device = MonkeyRunner.waitForConnection() #対象のアプリのパッケージ名 package = 'com.sample.hoge' #強制終了ボタンの位置と、OKボタンの位置。デバイス依存 exitButton = [130, 180] okButton = [130, 550 ] #アプリ情報画面を呼び出し device.startActivity( action='android.settings.APPLICATION_DETAILS_SETTINGS', uri='package:'+package) time.sleep(1) device.touch( exitButton[0], exitButton[1], MonkeyDevice.DOWN_AND_UP) time.sleep(1) device.touch( okButton[0], okButton[1], MonkeyDevice.DOWN_AND_UP)
<package.DetectableKeyboardEventLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:id="@+id/root" > <!-- main layout --> </package.DetectableKeyboardEventLayout>
DetectableKeyboardEventLayout root = (DetectableKeyboardEventLayout)findViewById(R.id.root); root.setKeyboardListener( new KeyboardListener() { @Override public void onKeyboardShown() { Log.d(TAG, "keyboard shown"); } @Override public void onKeyboardHidden() { Log.d(TAG, "keyboard hidden"); } });