We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,608 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

How to display arraylist in my imageAdapater??

Hi,
I am trying to pass the value of imgPath into imageAdapter.java.
I manage to get the result from the toast. But i did not know how to write a proper code to display the value at myRemoteImages. Please help me out.

PictureActivity.java

ArrayList<hashmap<string, string="">> imgList = new ArrayList<hashmap<string, string="">>();

try {
imageLink = json.getJSONArray(TAG_IMG);

for(int i = 0; i < imageLink.length(); i++){
JSONObject c = imageLink.getJSONObject(i);
String imgPath = c.getString(TAG_PATH);

HashMap<string, string=""> map = new HashMap<string, string="">();
map.put(TAG_PATH, imgPath);

imgList.add(map);
Toast.makeText(this, map.get(TAG_PATH), Toast.LENGTH_LONG).show();
}
}catch (JSONException e) {
e.printStackTrace();
}
((GridView) findViewById(R.id.grid_layout))
.setAdapter(new ImageAdapter(this,imgList));

ImageAdapter.java

public class ImageAdapter extends BaseAdapter {
ArrayList<hashmap<string, string="">> data = null;
private Context mContext;

public ImageAdapter(Context context, ArrayList<hashmap<string, string="">> data){
this.mContext = context;
this.data = data;
}

public String[] myRemoteImages = { //How to put the array imagePath here, what code shoud i write??};
}
2
Contributors
1
Reply
6 Hours
Discussion Span
1 Year Ago
Last Updated
2
Views
Erickk
Newbie Poster
4 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

You failed to specify where from you are getting remote images.
Also would be nice you check your code because there are plenty of errors. Java is not case insensitive like html

peter_budo
Code tags enforcer
Moderator
15,812 posts since Dec 2004
Reputation Points: 2,871
Solved Threads: 944
Skill Endorsements: 52

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.0643 seconds using 2.73MB