I have been referring this app to make a gallery module
https://github.com/nostra13/Android-Universal-Image-Loader
However according to the requirement in my app the images are dynamically added.So, I am fetching all the images via JSON.The image response from JSON Iam adding in the arraylist.
How should I pass "image_urls.add(folio.getString(i));" in the new class :
public class Test extends Activity{
private static String url = "http://www.xyz.com/album_pro/array_to_encode";
JSONArray folio = null;
ArrayList<String> urlList = new ArrayList<String>();
@SuppressLint("NewApi")
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
JSONParser jParser = new JSONParser();
{
try{
JSONObject json = jParser.getJSONFromUrl(url);
Log.v("URL",json.toString());
JSONObject seo = json.getJSONObject("SEO");
Log.v("seo",seo.toString());
JSONArray folio = seo.getJSONArray("Folio");
ArrayList<String> image_urls = new ArrayList<String>();
for(int i=0;i< folio.length();i++)
{
image_urls.add(folio.getString(i));
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
}
How should I pass "image_urls.add(folio.getString(i));" in a non activity class named "Images"
i.e
public class Images {
public final static String[] imageUrls = new String[] {
**Required the arraylist of "Test" activity**
};
public final static String[] imageThumbUrls = new String[] {
**Required the arraylist of "Test" activity**
};
}