title: Parsing jsoup list
body: <p>I created a list in which i parse a webpage. I can display the titles and the first image of the first article but what i want is display the image for each article. This is the code:</p>
  
  <p>EDITED CODE</p>
  
  <pre><code>public class MainActivity extends Activity{
      ProgressDialog mProgressDialog;
      public static final String TAG_TITOLI = "titoli";
      private static final String TAG_IMMAGINE = "immagine";
      ListView lista;
      Bitmap bitmap;
      public ImageView immagine;
      public ImageView logoimg;
  
      static final String BLOG_URL = "http://www.multiplayer.it";
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          lista = (ListView)this.findViewById(R.id.main_lista);//recupero lista da id
  
  
  
          //View inflatedView = getLayoutInflater().inflate(R.layout.riga_listview, null);
          //immaginebtn = (Button)findViewById(R.id.immaginebtn);
          //creo ed eseguo l'asynctask
          ParsingPaginaWeb parsing = new ParsingPaginaWeb();
          parsing.execute("");
  
          // Immagine btn
          /*immaginebtn.setOnClickListener(new OnClickListener() {
              public void onClick(View arg0) {
                  // Execute Logo AsyncTask
                  new Logo().execute();
              }
          });*/
          //new Logo().execute();
  
           // Launching new screen on Selecting Single ListItem
              lista.setOnItemClickListener(new OnItemClickListener() {
  
                  @Override
                  public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                          int position, long id) {
                      // getting values from selected ListItem
                      String titoli = ((TextView) view.findViewById(R.id.riga_listview_titolo)).getText().toString();
                      immagine = ((ImageView) view.findViewById(R.id.imageView1));
  
                      // Starting new intent
                      Intent in = new Intent(getApplicationContext(), SingleActivity.class);
                      in.putExtra(TAG_TITOLI, titoli);
                      in.putExtra(TAG_IMMAGINE, bitmap);
                      //in.putExtra(TAG_CONTENT, cont);
                      startActivity(in);
  
                  }
              });
  
      }
  
      private class ParsingPaginaWeb extends AsyncTask&lt;String,String,String&gt; {
  
          ArrayList&lt;String&gt; titoli; //lista dei titoli
          ArrayList&lt;Bitmap&gt; bitmap = new ArrayList&lt;Bitmap&gt;(); 
          //ArrayList&lt;String&gt; content; //lista delle descrizioni
  
          @Override
          protected void onPreExecute()
          {   
              //prima di eseguire il parsing inizializzo gli arraylist
              mProgressDialog = new ProgressDialog(MainActivity.this);
              mProgressDialog.setTitle("Multiplayer.it");
              mProgressDialog.setMessage("Caricamento articoli...");
              mProgressDialog.setIndeterminate(false);
              mProgressDialog.show();
  
              titoli = new ArrayList&lt;String&gt;();
              bitmap = new ArrayList&lt;Bitmap&gt;(); 
              //content = new ArrayList&lt;String&gt;();
          }
  
          @Override
          protected String doInBackground(String... params) {
              try {
  
                  Document doc = Jsoup.connect(BLOG_URL).get();
                  Elements nodeBlogStats = doc.select("div.news-col-0 h3"); //per multiplayer.it Elements nodeBlogStats = doc.select("div.news-col-0 h3"); per ftv #comunePartINI &gt; option
                  for(Element sezione : nodeBlogStats)
                  {
                      titoli.add(sezione.text());
  
                  }
              } catch (Exception e) {
                  // In caso di errore
                  Log.e("ESEMPIO", "ERRORE NEL PARSING");
              }
              return null;
          }
  
  
  
          @Override
          protected void onPostExecute(String result)
          {
              // dopo che ho eseguito il parsing mostro i dati nella listview
              // usando il custom array adpater ParsingArrayAdapter
              ParsingArrayAdapter adapter = new ParsingArrayAdapter(MainActivity.this, titoli, bitmap);
              lista.setAdapter(adapter);
              mProgressDialog.dismiss();
              new Logo().execute();
          }
  
  
      }
  
      // Classe per caricamento immagini..
  
      // Logo AsyncTask
  
      private class Logo extends AsyncTask&lt;Void, Void, Void&gt; {
  
  
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
              mProgressDialog = new ProgressDialog(MainActivity.this);
              mProgressDialog.setTitle("Immagini");
              mProgressDialog.setMessage("Loading images...");
              mProgressDialog.setIndeterminate(false);
              mProgressDialog.show();
          }
  
          @Override
          protected Void doInBackground(Void... params) {
  
              try {
                  // Connect to the web site
                  Document document = Jsoup.connect(BLOG_URL).get();
                  // Using Elements to get the class data 
                  //Elements img = document.select("div.news-col-0 img[src]");
                  // Locate the src attribute
                  for(Element img : document.select("div.news-col-0 img[src]")) {
                      String ImgSrc = img.attr("src");
                  // Download image from URL
                  InputStream input = new java.net.URL(ImgSrc).openStream();
                  // Decode Bitmap
                  bitmap = BitmapFactory.decodeStream(input);
                  }
              } catch (IOException e) {
                  e.printStackTrace();
              }
              return null;
          }
  
          @Override
          protected void onPostExecute(Void result) {
              // Set downloaded image into ImageView
              logoimg = (ImageView) findViewById(R.id.imageView1);
              logoimg.setImageBitmap(bitmap);
              mProgressDialog.dismiss();
  
             // ParsingArrayAdapter adapter = new ParsingArrayAdapter(MainActivity.this, titoli);
             // lista.setAdapter(adapter);
          }
      }
  
  }
  </code></pre>
  
  <p>How can i solve?</p>
  
  <p>EDIT:
  Adapter class:</p>
  
  <pre><code>public class ParsingArrayAdapter extends ArrayAdapter&lt;String&gt;{
  
      //ID and resources references
      private final static int LAYOUT = R.layout.riga_listview;
      private final static int TITOLO = R.id.riga_listview_titolo;
      private final static int IMMAGINE = R.id.imageView1;
  
      ArrayList&lt;Bitmap&gt; bitmap ; 
  
      ArrayList&lt;String&gt; titoli; //lista dei titoli
  
      Context c; //context
      LayoutInflater inflater; //layout inflater
  
      public ParsingArrayAdapter(Context context,ArrayList&lt;String&gt; titoli, ArrayList&lt;Bitmap&gt; bitmap)
      {
          super(context,TITOLO);
          this.c = context;
          this.titoli = titoli;
          this.bitmap = bitmap;
          this.inflater = LayoutInflater.from(c);
      }
  
      @Override
      public int getCount()
      {
          return titoli.size(); //List lenght 
      }
  
      @SuppressLint("NewApi")
      @Override
      public View getView(int pos,View view,ViewGroup parent)
      {
          CacheRiga cache; //cache
          if(view==null)
          {
  
              view = inflater.inflate(LAYOUT, parent,false); 
              cache = new CacheRiga(); //inizializzo la cache
              cache.titolo = (TextView) view.findViewById(TITOLO); //title
  
              cache.immagini = (ImageView) view.findViewById(IMMAGINE);//collego descrizione
  
  
              view.setTag(cache);
          }
          else
          {
              cache = (CacheRiga) view.getTag(); 
          }
  
          cache.titolo.setText(titoli.get(pos)); //I set up the title
  
          //cache.immagini.setImageBitmap(bitmap.get(pos));
  
  
  
          return view;
      }
  
      private class CacheRiga { // Cache class
          public TextView titolo; // Title cache
          public ImageView immagini; // Image cache
      }
  
  }
  </code></pre>