Skip to content Skip to sidebar Skip to footer

Android Square Picasso Not Load Turkish Character Image Url

I try use square picasso a web Application. But if my img url contains Turkish characters. Picasso not load img. This URL is working. http://www.bulenttiras.com/wp-content/uploads/

Solution 1:

I had the same issue. The only option i could find was replacing all the single Turkish character with the encoded one.

publicstaticStringencodeTurkishCharactersInUrl(String url) {
        String[] list = newString[] {"ü","ç","ı","ö","ğ","ş"," ","Ü","Ç","İ","Ö","Ğ","Ş"};
        for (int i = 0; i< list.length ; i++) {
            try {
                url = url.replace(list[i], URLEncoder.encode(list[i],"UTF-8"));
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
        }

        return url;
    }

Solution 2:

You probably missing internet permission on your manifest.

Edit: Here's the code.

<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:paddingBottom="@dimen/activity_vertical_margin"android:paddingLeft="@dimen/activity_horizontal_margin"android:paddingRight="@dimen/activity_horizontal_margin"android:paddingTop="@dimen/activity_vertical_margin"tools:context=".MainActivity" >

    <ImageViewandroid:id="@+id/imageView1"android:layout_width="fill_parent"android:layout_height="fill_parent"android:src="@drawable/ic_launcher" />

</LinearLayout>




publicclassMainActivityextendsActivity {
    @OverrideprotectedvoidonCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Picasso.with(this).load("http://www.bulenttiras.com/wp-content/uploads/2014/03/t%C3%BCp-bebek-tedavisi.jpg").into((ImageView)findViewById(R.id.imageView1), newCallback() {

            @OverridepublicvoidonSuccess() {
                Log.v("Information", "Success!");
            }

            @OverridepublicvoidonError() {
                Log.v("Information", "FAIL!");
            }
        });
    }
}   

Post a Comment for "Android Square Picasso Not Load Turkish Character Image Url"