In the Parcel class there is no method for writing short , how do I write class fields for which type short? via writeInt() ?
- why not? - georgehardcore
|
2 answers
If you have a short primitive, then it is easier to write back through writeInt () , while reading.
If you have a Short object, you can use writeValue () , it can:
void writeValue (Object v)
Flatten a generic object in to a parcel. The given Object value may be currently one of the following types:
- null
- String
- Byte
- Short
- ....
|
As an alternative to the method specified by @tse, you can use writeBundle() , where in Bundle pack short via putShort()
|