如何从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