0

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
2
Views
4 Years
Discussion Span
Last Post by peter_budo
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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.