-1
Good afternoon, everyone,
I have a string that I use to set the image of some buttons:
String imagem[] = {"https://cdn.pixabay.com/photo/2015/12121.jpg",
"https://cdn.pixabay.com/photo/2016/0555555.jpg"};
I downloaded the images and saved in the src main images directory inside the project.
How can I replace the url in the string above with the local path?
Follow the detailed code:
In my onCreateView:
mAdapter = new ModuloAdapter(lista(), getActivity());
private List<ItemModulo> lista() {
String titulo[] = {"A", "B", "C", "D"};
String imagem[] = {"https://cdn.pixabay.com/photo/2015/10/19/20/01/5555.jpg",
"https://cdn.pixabay.com/photo/2016/02/11/23/24/5554.jpg",
"https://cdn.pixabay.com/photo/2016/11/08/05/29/44141.jpg",
"https://cdn.pixabay.com/photo/2016/11/08/05/29/4412241.jpg"};
for (int i = 0; i < titulo.length; i++){
ItemModulo item = new ItemModulo();
item.setLista(lista[i]);
item.setImagem(imagem[i]);
itemList.add(item);
}
return itemList;
}
Details more how you are setting the image on the buttons
– Murillo Comino
I edited in more detail
– user147627
Still kind of confused, what you want is that at runtime the application will download the images pro appliance, and these saved images will be used on the button?
– Murillo Comino
not I will use the image already downloaded and placed in drawable but I am not able to use the direct image only with the link.... would like to place the image path in the string instead of the url
– user147627