ArrayList declaration in method
viewHolder.photo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { v.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { List<String> images = new ArrayList<>(); Intent intent = new Intent(context, FullScreenViewActivity.class); intent.putExtra("position", position); images.add(0, "https://" + StringUtil.URLADS_THUMBLER_IMAGE + images.get(position)); intent.putStringArrayListExtra("items_to_parse", (ArrayList<String>) images); context.startActivity(intent); } }); At the moment I tried to add a link to the image in this way.
images.add(0, "https://" + StringUtil.URLADS_THUMBLER_IMAGE + images.get(position)); But knocks error:
java.lang.IndexOutOfBoundsException: Invalid index 1, size is 0
But I need to add several links , and they are not fixed - each time they are different (they are entered by users).