我在测验应用程序中遇到问题...
我的问题是..
我通过 JSON 获得了 Questionid、问题和答案。我用单键存储在哈希图中。现在我想做的是...
如何根据 questionid 从 hashmap 获取问题和答案..在文本视图中显示问题并在单选按钮中显示答案...
我该如何实施?任何帮助将不胜感激......提前非常感谢......
protected void onPostExecute(String file_url) { pDialog.dismiss(); List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("tid", tid)); JSONObject json = jsonParser.makeHttpRequest(url_get_quesid, "GET", params); json = jsonParser.makeHttpRequest(url_get_quesurl, "GET", params); try { int success = json.getInt(TAG_SUCCESS); if (success == 1) { System.out.println("Success"); groups = json.getJSONArray(TAG_GROUP); System.out.println("Result Success+++"+groups); for (int i = 0; i < groups.length();i++) { JSONObject c = groups.getJSONObject(i); String questionid = c.getString(TAG_QUESID); String question = c.getString(TAG_QUES); String answer = c.getString(TAG_ANSW); System.out.println("Checking ::"+questionid); id=questionid; quesid.add(questionid); HashMap<String, String> map = new HashMap<String, String>(); map.put(questionid, question + ";" + answer); System.out.println("QuestionIDMap:"+map); } } else { showAlert(); } } catch (JSONException e) { System.out.println("Error "+e.toString()); } }