In the onClick method I use the following structure:

Intent intent = new Intent(context, FullScreenViewActivity.class); intent.putExtra("position", position); intent.putStringArrayListExtra("items_to_parse", (ArrayList<String>) allPhoto); allPhoto.add(0, "link"); context.startActivity(intent); 

Inserting any link in the "link" field, opens the image, not quite correctly, but the essence itself. Now I want to do the same thing, but getting a specific link, namely, getting it from my model as follows:

 allPhoto.add(imageUploads.get(position).getUrl()); 

But I get an error, and I can't see which one, since logcat does not open. ImageUpload class:

 public class ImageUpload { @SerializedName("success") @Expose private Boolean success; @SerializedName("output_metadata") @Expose private OutputMetadata outputMetadata; @SerializedName("handler") @Expose private Integer handler; @SerializedName("id") @Expose private String id; private List<VideoUpload> videoUploads = new ArrayList<>(); @SerializedName("url") @Expose private String url; public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public List<VideoUpload> getVideoUploads() { return videoUploads; } public void setVideoUploads(List<VideoUpload> videoUploads) { this.videoUploads = videoUploads; } boolean loadImage = false; String Path; public boolean isLoadImage() { return loadImage; } public void setLoadImage(boolean loadImage) { this.loadImage = loadImage; } public String getPath() { return Path; } public void setPath(String path) { Path = path; } public Boolean getSuccess() { return success; } public void setSuccess(Boolean success) { this.success = success; } public OutputMetadata getOutputMetadata() { return outputMetadata; } public void setOutputMetadata(OutputMetadata outputMetadata) { this.outputMetadata = outputMetadata; } public Integer getHandler() { return handler; } public void setHandler(Integer handler) { this.handler = handler; } public String getId() { return id; } public void setId(String id) { this.id = id; } 

VideoUpload class VideoUpload

 public class VideoUpload { @SerializedName("id") @Expose private String id; @SerializedName("videoUrl") @Expose String videoUrl; @SerializedName("user_portrait_huge") @Expose private String userPortraitHuge; @SerializedName("url") @Expose private String url; public String getUserPortraitHuge() { return userPortraitHuge; } public void setUserPortraitHuge(String userPortraitHuge) { this.userPortraitHuge = userPortraitHuge; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } boolean loadImage = false; public String getVideoUrl() { return videoUrl; } public void setVideoUrl(String videoUrl) { this.videoUrl = videoUrl; } public String getId() { return id; } public void setId(String id) { this.id = id; } public boolean isLoadImage() { return loadImage; } public void setLoadImage(boolean loadImage) { this.loadImage = loadImage; } 

FullScreenViewActivity

 public class FullScreenViewActivity extends Activity { private FullScreenImageAdapter adapter; private ViewPager viewPager; ArrayList<String> photo = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fullscreen_view); viewPager = (ViewPager) findViewById(R.id.pager); int position = 0; Intent i = getIntent(); if (i != null) { position = i.getIntExtra("position", 0); photo.addAll(getIntent().getExtras().getStringArrayList("items_to_parse")); } Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); int width = size.x; // int height = size.y; adapter = new FullScreenImageAdapter(FullScreenViewActivity.this, photo,width); viewPager.setAdapter(adapter); viewPager.setCurrentItem(position); } 

}

enter image description here

  • Add the code of the VideoUpload class and the full code of the ImageUpload class. - post_zeew
  • @post_zeew updated the question. - Inkognito
  • imageUploads - what class object? - post_zeew
  • @post_zeew ImageUpload, sort of like - Inkognito
  • @post_zeew seems to be all right, no? - Inkognito

1 answer 1

Information about the format of the link that contains the VideoUpload object VideoUpload not be obtained, so the answer will be based on the assumption that the format is:

 http://... 

The allPhoto collection containing such links is transferred to the FullScreenImageAdapter adapter, which uploads images by uri , which is formed as follows

 String uri = "https://" + StringUtil.URLADS_THUMBLER_IMAGE + _imagePaths.get(position).toString(); 

From here it can be understood that the uri turns out to be incorrect, since at least it will contain two sequences indicating the protocol, separated by some StringUtil.URLADS_THUMBLER_IMAGE .

The problem can be solved, for example, the implementation of the adapter so that it does not spoil these very links. Something like this:

 String uri = _imagePaths.get(position).toString(); 

In this case, most likely it will be necessary to recycle and other parts of the adapter.