7
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Android] Butter Knife で Spinner の選択イベントを取得する

Posted at

Butter Knife の公式ページ には明記してなかったけど、次のように書いてみたら出来た。

今回は Butter Knfie 6.1.0 を使用

@OnItemSelected(R.id.hogeSpinner)
public void onItemSelectedHogeSpinner(Spinner spinner) {

    // リストの何番目が選択されたか
    int position = spinner.getSelectedItemPosition();
    // 選択されたアイテム名
    String item = (String)spinner.getSelectedItem();

	//..
}

ちなみに Butter Knife は次のようなイベントが取れるので、積極的に活用していきたいところ!

スクリーンショット 2015-03-26 17.35.23.png

7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?