21
18

More than 5 years have passed since last update.

Intent に Enum を詰めて、取り出す

Last updated at Posted at 2014-04-23
enum
public enum MyTypes {
    One,
    Two,
    Three
}
put
intent.putExtra("hoge",MyType.Two);
get
MyTypes t = (MyTypes)intent.getSerializableExtra("hoge");

取り出すのは getSerializableExtra であることに注意。

なんか int に変換されそうじゃん、と思って getIntExtra を使うと取り出せない。

21
18
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
21
18