我有一個Bundle
和我將其存儲到盤作爲一個字節數組。現在,當我檢索它時,我接受字節數組。我怎樣才能再次將其轉換爲Bundle
?字節數組捆綁
byte fileContent[] = new byte[(int)file.length()];
int numerOfReturnedbytes = 0;
try {
//read the stream and set it into the byte array readFileByteArray
//and returns the numerOfReturnedbytes. If returns -1 means that
//that the end of the stream has been reached.
numerOfReturnedbytes = fis.read(fileContent);
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
if (numerOfReturnedbytes == -1) {
return;
} else {
//creating empty parcel object
Parcel parcel = Parcel.obtain();
//un-marshalling the data contained into the byte array to the parcel
parcel.unmarshall(fileContent, 0, numerOfReturnedbytes);
}
fileContent
是字節數組。關於如何解決我的問題的任何想法?
我不明白你的問題 – njzk2