I have an adapter that must take the address of the image from the class object and pass it to the Picasso method.
But the fact is that the picture has an address with Russian characters, or Russian characters are in the way of the address, so Picasso does not want to load it, as I understand it. What solutions can be used?
In the path of the address "http: //" also added, did not help. Other pictures loads (checked with a commented line)
URLDecoder and URLEncoder have already started using it, I thought it would work in another encoding, no, it did not work = (
GIF format seems to be supported by Picasso, so I don’t sin on the extension of the picture
public View getView(int position, View convertView, ViewGroup parent) { // LayoutInflater vi = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); // 3 обязательные строки при создании Array адаптера View newView = vi.inflate(R.layout.item_news, parent, false); // (в Cursor адаптере метод bindview) TextView tv1 = (TextView) newView.findViewById(R.id.textListViewZagolovok); TextView tv2 = (TextView) newView.findViewById(R.id.textListViewOpisanie); ImageView imv = (ImageView) newView.findViewById(R.id.imageListViewNovosti); String url = abc.get(position).image; // String url = "https://i.ytimg.com/vi/-DRziE7lYsk/hqdefault.jpg"; Log.e("pic in adapter", url); tv1.setText(abc.get(position).title); tv2.setText(abc.get(position).content); try{ // вот здесь косячит Picasso.with(context).load(URLEncoder.encode(url)).placeholder(R.drawable.headeronmenu).error(R.drawable.krest).into(imv); Log.e("encode", "0 " + url); Log.e("encode", "1 " + URLEncoder.encode(url, "UTF-8")); Log.e("encode", "2 " + URLDecoder.decode(url, "UTF-8")); }catch (UnsupportedEncodingException e){ e.printStackTrace(); } if(position == abc.size()-4 && !flagDow){ flagDow = true; downNextPage.startDowNextPage(); } return newView; } Logs:
03-24 10:42:55.525 21687-21687/ru.diitcenter.lakdistrict E/pic in adapter: gazikumuh.ru/images/2016/ЦиркХури.gif 03-24 10:42:55.640 21687-21687/ru.diitcenter.lakdistrict E/encode: 0 gazikumuh.ru/images/2016/ЦиркХури.gif 03-24 10:42:55.645 21687-21687/ru.diitcenter.lakdistrict E/encode: 1 gazikumuh.ru%2Fimages%2F2016%2F%D0%A6%D0%B8%D1%80%D0%BA%D0%A5%D1%83%D1%80%D0%B8.gif 03-24 10:42:55.645 21687-21687/ru.diitcenter.lakdistrict E/encode: 2 gazikumuh.ru/images/2016/ЦиркХури.gif 03-24 10:42:55.720 21687-21687/ru.diitcenter.lakdistrict E/pic in adapter: gazikumuh.ru/images/2016/КурклиКультура.gif 03-24 10:42:55.720 21687-21687/ru.diitcenter.lakdistrict E/encode: 0 gazikumuh.ru/images/2016/КурклиКультура.gif 03-24 10:42:55.725 21687-21687/ru.diitcenter.lakdistrict E/encode: 1 gazikumuh.ru%2Fimages%2F2016%2F%D0%9A%D1%83%D1%80%D0%BA%D0%BB%D0%B8%D0%9A%D1%83%D0%BB%D1%8C%D1%82%D1%83%D1%80%D0%B0.gif 03-24 10:42:55.725 21687-21687/ru.diitcenter.lakdistrict E/encode: 2 gazikumuh.ru/images/2016/КурклиКультура.gif 03-24 10:43:00.760 21687-21687/ru.diitcenter.lakdistrict E/111: AboutNewsActivity.url = gazikumuh.ru/images/2016/ЦиркХури.gif (Pictures in the browser open)