String[][] myArrs = ....;
想把这个二维数组传递给另一个Activity
怎么做?求指教
putSerializable能添数组就能接收
//Send
String[][] myArrs = ...
bundle.putSerializable("fileList", myArrs);
//Get
Object[] objectArray = (Object[]) getIntent().getExtras().getSerializable("fileList"); int horizontalLength = 0; if (objectArray.length > 0) horizontalLength = ((Object[]) objectArray[0]).length; fileArr = new String[objectArray.length][horizontalLength]; int i = 0; for(Object row : objectArray) { fileArr[i][0] = ((String[])row)[0]; fileArr[i++][1] = ((String[])row)[1]; } 希望你能明白其传递原理 |
Copyrights © SnowCoal.com