我正在尝试加载我的Android应用程序的数据,这是几个(float [] [] [] [])数组。 我已成功将所提到的数组保存在Jsonarray []中,然后保存到Jsonobject中,最后将Jsonobject保存在文件中,我已经可以在保存的文件中看到我的数据。 我面临的问题是,我不知道如何从Jsonarray []中检索我的数组。任何人都可以帮我搞清楚吗?
以下是我保存和重新加载数据的代码:
func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.size.width, height: 18))
let label = UILabel(frame: CGRect(x: 20, y: 20, width: 50, height: 50))
label.text = "TEST TEXT"
label.textColor = UIColor.whiteColor()
self.view.addSubview(view)
return view
}

这是我保存文件格式的剪辑:
float[][][][] array1,array2;
//save them with JsonArray
try {
JSONObject data_Json = new JSONObject();
JSONArray[] data_Json_Array = new JSONArray[2];
data_Json_Array[0] = new JSONArray(array1);
data_Json_Array[1] = new JSONArray(array2);
for (int i = 0 ; i < 2 ; i++)
data_Json.put(String.valueOf(i) , data_Json_Array[i]);
String data_string = data_Json.toString();
//card_object is the JSONObject that I want to store.
File myFile = new File("/sdcard/DATA_Json/myJasonData.txt");
myFile.createNewFile();
FileOutputStream fOut = new FileOutputStream(myFile);
OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut);
myOutWriter.write(data_string);
myOutWriter.close();
fOut.close();
Log.d("Json Message: " ,"Done writing SD 'myJasonData.txt'");
}catch (Exception e)
{
Log.d("Json Error: " , e.getMessage());
}
//Reloading arrays from jsonarray
try {
JSONObject data_Json = new JSONObject("/sdcard/DATA_Json/myJasonData.txt");
JSONArray[] data_Json_Array = new JSONArray[2];
for (int i = 0 ; i < 2 ; i++)
data_Json_Array[i] = (JSONArray) data_Json.get(String.valueOf(i));
array1 = data_Json_Array[0].?; //what should I do here?
}catch (Exception e)
{
Log.d("Json Error: " , e.getMessage());
}
&#13;