Load Image from url in List View with Picasso in Android Studio
<p>I want to display image from database to ListView.
I want to use picasso to load the image. But i don't know how to put the picasso there. Can you tell me where should i put it.
Thank you..    </p>

<pre><code>import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import android.app.Activity;
import android.media.Image;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import com.squareup.picasso.Picasso;

import org.apache.http.NameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class MainActivity extends ActionBarActivity {
    JSONParser jParser= new JSONParser();
    ArrayList&lt;HashMap&lt;String, String&gt;&gt; nameList;
    JSONArray names=null;
    ListView data;
    private static final String URL_TEST_BARANG= "http://lomapod.azurewebsites.net/readBarang.php?id_penjual=1";
    private static final String TAG_PESAN = "message";
    private static final String TAG_HASIL = "result";
    private static final String TAG_BARANG = "nama_barang";
    private static final String TAG_IMAGE= "nama";
    ImageView imageview;
    int myInt=0;
    public  MainActivity()
    {}

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        data=(ListView) findViewById(R.id.lvSeller);
        nameList= new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
        imageview =(ImageView) findViewById(R.id.imageView);
    }


    public class AmbilDataJson extends AsyncTask&lt;String,String,String&gt; {

        int sukses=0;

        public AmbilDataJson() {

        }

        @Override
        protected void onPreExecute() {
            super.onPreExecute();
        }

        @Override
        protected String doInBackground(String... args) {

            List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();

            try
            {
                JSONObject json = jParser.makeHttpRequest(URL_TEST_BARANG, "GET", params);

                if(json != null)
                {
                    sukses = json.getInt(TAG_PESAN);
                    if(sukses == 1)
                    {
                        nameList = new ArrayList&lt;HashMap&lt;String,String&gt;&gt;();
                        Log.d("Semua Nama: ", json.toString());
                        names = json.getJSONArray(TAG_HASIL);

                        for(int i = 0; i &lt; names.length();i++)
                        {
                            JSONObject c = names.getJSONObject(i);
                            String id = c.getString(TAG_BARANG);
                            String seller = "lomapod.esy.es/assets/"+c.getString(TAG_IMAGE);

                            HashMap&lt;String,String&gt; map = new HashMap&lt;String,String&gt;();

                            map.put(TAG_BARANG,id);
                            map.put(TAG_IMAGE,seller);
                            nameList.add(map);
                        }
                    }
                }
            }catch(JSONException e)
            {
                e.printStackTrace();
            }

            return null;
        }

        @Override
        protected void onPostExecute(String s) {
            if(sukses == 1 )
            {
                ListAdapter adapter = new SimpleAdapter(
                        getApplicationContext(),nameList,
                        R.layout.grid_item,new String[]
                        {
                                TAG_BARANG,TAG_IMAGE
                        }
                        ,new int[]
                        {
                                R.id.tvSeller, R.id.imageView
                        }

                );
                data.setAdapter(adapter);
            }
        }
    }

}
</code></pre>

<p>this is the picasso code that i want to use. TAG_IMAGE is the picture URL that should be load</p>

<pre><code>Picasso.with(this)
    .load(TAG_IMAGE)
    .into(imageView);
</code></pre>