Add Library in Picasso
compile 'com.squareup.picasso:picasso:2.5.2'
PicassoActivity.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.bhaumik.networkingtask.PicassoActivity">
<ImageView
android:id="@+id/image_view_picasso"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
PicassoActivity.java
package com.example.bhaumik.networkingtask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;
import com.squareup.picasso.Picasso;
public class PicassoActivity extends AppCompatActivity {
String url = "https://www.codeproject.com/KB/GDI-plus/ImageProcessing2/flip.jpg";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_picasso);
ImageView imageView = (ImageView) findViewById(R.id.image_view_picasso);
Picasso.with(PicassoActivity.this).load(url).into(imageView);
}
}
0 comments:
Post a Comment