【发布时间】:2015-12-16 06:55:38
【问题描述】:
如何在ListView中显示多行数据?
现在我一次只能检索和显示一个数据(项目),我想检索多行数据(项目)并将它们全部显示在ListView 中。
在这种情况下,我使用用户名来检索他/她在数据库中的优惠券。所以我只能显示一张优惠券,我想知道如何在ListView中显示多张优惠券。
protected String doInBackground(String... args) {
// Check for success tag
int success;
try {
// Building Parameters
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("name", name));
JSONObject json = jsonParser.makeHttpRequest(
url_all_coupons, "GET", params);
Log.d("Single Voucher Details", json.toString());
// json success tag
success = json.getInt(TAG_SUCCESS);
if (success == 1) {
JSONArray productObj = json
.getJSONArray(TAG_COUPONS); // JSON Array
JSONObject coupons = productObj.getJSONObject(0);
【问题讨论】:
标签: android listview android-listview