コード例 #1
0
 /**
  * @see android.app.Activity#onCreateContextMenu(android.view.ContextMenu, android.view.View,
  *     android.view.ContextMenu.ContextMenuInfo)
  */
 @Override
 public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
   if (v.getId() == R.id.query_history_all) {
     menu.setHeaderTitle(Preferences.getText(this, "履歴の編集"));
     menu.add(0, MENU_ITEM_DELETE, 1, "削除");
     menu.add(0, MENU_ITEM_CANCEL, 2, "キャンセル");
   } else if (v.getId() == R.id.query_history_location) {
     menu.setHeaderTitle(Preferences.getText(this, "目的地の編集"));
     menu.add(0, MENU_ITEM_SET_FROM, 1, "出発地に設定");
     menu.add(0, MENU_ITEM_SET_TO, 2, "到着地に設定");
     menu.add(0, MENU_ITEM_CANCEL, 3, "キャンセル");
   }
 }
コード例 #2
0
  private void initView() {
    Preferences.initTheme(this);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.query_history_tab);

    TabHost th = getTabHost();
    registerForContextMenu(th);

    th.addTab(
        th.newTabSpec(TAG_FAVORITE).setIndicator("お気に入り").setContent(R.id.query_history_favorite));
    th.addTab(th.newTabSpec(TAG_ALL).setIndicator("検索履歴").setContent(R.id.query_history_all));
    th.addTab(
        th.newTabSpec(TAG_LOCATION).setIndicator("目的地履歴").setContent(R.id.query_history_location));
    th.setCurrentTab(1);
  }