我需要您从MySQL数据库获取有关retreive数据的帮助。我不能将字符串添加到数组列表。 我的名单宣布如何将字符串转换为ArrayList
ArrayList<HandleListReport> reportList = new ArrayList<HandleListReport>();
这里我的代码
report_data = json.getJSONArray(TAG_REPORT_DATA);
for (int i = 0; i < report_data.length(); i++) {
//storing variable
JSONObject c = report_data.getJSONObject(i);
String reportID = c.getString(TAG_REPORT_ID);
String userID = c.getString(TAG_UID);
String projectName = c.getString(TAG_PROJECT_NAME);
String localWork = c.getString(TAG_LOCATION);
String timeStart = c.getString(TAG_TIME_START);
String timeEnd = c.getString(TAG_TIME_END);
Log.d(TAG_LOCATION, localWork);
// add data to Arraylist
reportList.add(new HandleListReport(reportID, userID, projectName, localWork, timeStart, timeEnd));
我的问题,我的listReport缺少字符串数据。 Logcat show reportList ---> []
感谢您的回答!
你在哪里声明reportList。写在这里,还有你面临的问题是什么? – stinepike 2013-03-10 04:34:40
我的logcat在reportList上抛出[] – Ply 2013-03-10 04:39:45
在使用它们创建新的'HandleListReport'对象之前,您是否调试过代码以查找变量的值 'reportID,userID,projectName,localWork,timeStart,timeEnd'? – 2013-03-10 04:46:47