target Activity code.
This is menu create code.
menu.add(Menu.NONE, Menu.FIRST, Menu.NONE, "1"); menu.add(Menu.NONE, Menu.FIRST + 1, Menu.NONE, "2");This is menu pushed code.
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case Menu.FIRST: Log.d("test", "pushed 1"); break; case Menu.FIRST + 1: Log.d("test", "pushed 2"); break; default: break; } return true; }
This is Tester.
This is push menu and push menu button.
mInstrumentation.invokeMenuActionSync(mActivity, Menu.FIRST, 0);
Do test like here.
Logcat view follow:
pushed 1Target Activity source code is here.
Tester source code is here.
0 件のコメント:
コメントを投稿