I am trying to get 10 images from the server and programmatically create fresco draweeViews and put them into scrollable view.
What I have tried so far
private LinearLayout linearLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
linearLayout = findViewById(R.id.linearLayout);
Fresco.initialize(this);
getImages("1");
}
public void getImages(String size) {
for (int i = 1; i <= 10; i++) {
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
lp.setMargins(0, 0, 0, 0);
SimpleDraweeView image = new SimpleDraweeView(this);
image.setLayoutParams(lp);
// Adds the view to the layout
linearLayout.addView(image);
Uri uri = Uri.parse("https://desolate-beach-17272.herokuapp.com/downloadFile/" + size + "mb" + i + ".jpg");
image.setImageURI(uri);
}
}
This approached worked with picasso and glide but I couldn't make it work with fresco. Can somone help me with that?
By the way, the server is up and running so you can test it if you want