0

I'm attempting to add an ArrayList<Boolean> to an intent in Android and then retrieve it.

There are methods to add and retrieve Integer, String, etc. ArrayLists to and from intents, but I don't see any for an ArrayList<Boolean>. For now, I'm having to convert my ArrayList<Boolean> to a boolean[], add it to the intent, and then convert it back to an ArrayList<Boolean> when I retrieve it from the intent.

Is there a simpler way?

4

1 回答 1

3

调用putExtra(...)您的意图,然后输入您的 ArrayList。检索时,将getSerializableExtra方法调用的返回值转换为ArrayList<Boolean>.

更多信息: http: //developer.android.com/reference/android/content/Intent.html#putExtra (java.lang.String , java.io.Serializable)

于 2013-09-24T16:33:40.473 回答