0

ImageView dont show Image with URL with Russian letters. Tried URLEncode, but still dont work/ In project was used Fresco

 String norm = "http://www.rts-tender.ru/Portals/0/EasyDNNNews/1523/1523риадагестан.jpg";

 for(int j = 0; j < 32; j++){ 
try { 
          s = s.replace(""+((char)('а'+j)),""+URLEncoder.encode(""+  ((char)‌​('а'+j)),encoding)); 
} 
  catch (Exception e) { 
     e.printStackTrace(); 
   } 
}

 viewHolder.imagePreview.setImageURI(Uri.parse(norm));
  • I assume your *question* is something like _how to handle russian letters in an URI_. What happens exactly? How did you try to use URLEncode? – Michael Hoff Apr 13 '17 at 15:39
  • I can show Images with english URL. But russian, even with URLEncode doesnt work –  Apr 13 '17 at 15:57
  • for(int j = 0; j < 32; j++){ try { s = s.replace(""+((char)('а'+j)),""+URLEncoder.encode(""+((char)('а'+j)),encoding)); } catch (Exception e) { e.printStackTrace(); } } –  Apr 13 '17 at 16:00
  • Please update your question to contain this information (and format it as code, such that people can read it). – Michael Hoff Apr 13 '17 at 16:03
  • Your url does not work to begin with. Try it in a browser. – greenapps Apr 13 '17 at 19:18

2 Answers2

3

That's because ImageView does not support remote content. You need to download the image, or use Glide or Picasso to do that for you.

In me project was used Fresco, excuse me, i forgot.

Then it smells like Fresco's bug as image's source is completely irrelevant for ImageView.

Here's more useful link in this case:https://github.com/facebook/fresco/issues

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
0

Try:

String norm = "http://www.rtstender.ru/Portals/0/EasyDNNNews/1523/1523риадагестан.jpg";
URLEncoder.encode(norm, HTTP.UTF-8);
viewHolder.imagePreview.setImageURI(Uri.parse(norm));
Jéwôm'
  • 3,753
  • 5
  • 40
  • 73