For some reason Picasso is not loading image from URLs. I just see a blank white screen. I have already tried doing solutions to previous questions like these but nothing works for me.
Here is the Java code of Activity:
public class MainActivity extends AppCompatActivity {
ImageView mImageView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mImageView = (ImageView) findViewById(R.id.picassoImage);
Picasso.with(this).load("https://futurestud.io/images/books/picasso.png").into(mImageView);
}
}
And here is the XML layout code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns: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"
tools:context="com.example.sourabh.usingpicasso.MainActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/picassoImage"/>
</LinearLayout>
Note:-
I tried with different URLs but no luck.
I have already set the permission for Internet in Manifest.XML
When I chain the
errorwithPicasso.with(this).load("https://futurestud.io/images/books/picasso.png").into(mImageView)(iePicasso.with(this).load("https://futurestud.io/images/books/picasso.png") .error(R.drawable.ic_launcher_background). into(mImageView);
) and pass to it an Image from the drawable, the drawable image is displayed. Seems that Picasso is not loading image from URLs only.