2016-03-31 7 views
0

画像の名前がID.jpg(例:1.jpg/2.jpg/3.jpg ..など)のURLから画像を読み込みたいListViewがあります。 。 IDはデータベースからのものですが、すべての行についてListViewにロードされるイメージは1つのイメージ(1.jpg)です。Androidから画像をURLからListViewへ

txtDate.setText(Request_Date.get(position)); 
txtTime.setText(Request_Time.get(position)); 

//ivImage.setImageResource(imgid[position]); <-- this works from drawable and not from database 

Picasso.with(context).load(url_poster + request_eventID + ".jpg").into(ivImage); 

request_eventIDはDBからのIDで、これは私の問題であり、それだけで(IDの残りをしていない)1を返すので、そのためだけ1.JPGは、全ての行のリストビューにロードされます。

編集:私は私が疑わ同じように、System.out.println("IDs" +request_eventID)

+1

whatsは、データを取得するためのsqlクエリです。 – satyapol

+0

"request_eventID"の取得場所はどのようになっていますか? –

答えて

0

[OK]を実行した場合、私はコードで遊んすべてのIDを見ることができ、私は

JSONObject jsonResponse = new JSONObject(jsonResult); 
JSONArray jsonMainNode = jsonResponse.optJSONArray("read_columns"); 

for (int i = 0; i < jsonMainNode.length(); i++) { 
JSONObject jsonChildNode = jsonMainNode.getJSONObject(i); 
String request_date = jsonChildNode.optString("Date"); 
String request_time = jsonChildNode.optString("Time"); 
request_eventID = jsonChildNode.optString("EID"); 

arrRequest_Date.add(request_date); 
arrRequest_Time.add(request_time); 
arrRequest_EID.add(request_eventID); 

IDを取得する方法

注意ちょっとしたことが本当に私のIDに必要なものだった。

ソリューション:

Picasso.with(context).load(url_poster + Request_EID.get(position) + ".jpg").into(ivImage); 

が応答ありがとうございました。