如何從Arraylist中填充AlertDialog。 我的ArrayList是這樣的:如何從Arraylist填充AlertDialog?
{ Brand=Weber,
Category=Urethane,
Code=Wpu-01,
Description=Black,
Quantity=5;
Brand=Weber,
Category=Urethane,
Code=Wpu-02,
Description=White,
Quantity=10}
而且我想表明,在alertdialog是這樣
產品詳細信息
Weber Urethane Wpu-01 Black 5
Weber Urethane Wpu-02 White 10
然後一個按鈕( 「關閉」)
請幫幫我。提前致謝。
此代碼
public void updateJSONdata() {
orderlist = new ArrayList<HashMap<String, String>>();
JSONObject json = jParser.getJSONFromUrl(PRODUCTLIST_URL);
try {
order = json.getJSONArray(GET_PRODUCT);
for (int i = 0; i < order.length(); i++) {
JSONObject c = order.getJSONObject(i);
String id = c.getString(GET_ID);
String brand = c.getString(GET_BRAND);
String category = c.getString(GET_CATEGORY);
String description = c.getString(GET_DESCRIPTION);
String code = c.getString(GET_CODE);
String quantity = c.getString(GET_QUANTITY);
String unit = c.getString(GET_UNIT);
String unitprice = c.getString(GET_UNITPRICE);
HashMap<String, String> map = new HashMap<String, String>();
map.put(GET_ID,id);
map.put(GET_BRAND, brand);
map.put(GET_CATEGORY, category);
map.put(GET_DESCRIPTION, description);
map.put(GET_CODE, code);
map.put(GET_QUANTITY, quantity);
map.put(GET_UNIT, unit);
map.put(GET_UNITPRICE, unitprice);
orderlist.add(map);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
我已經使用的循環,但我不能得到任何數據 – Paul
INT I;對於(i = 0; i
Paul
@Mauker orderlist是我使用的Arraylist – Paul