There are 2 arrays:

ArrayList<String> One = new ArrayList<String>(); ArrayList<String> Two = new ArrayList<String>(); 

The One array is filled with a listView (in the One array, plain text). In the array Two - a link to the explanation of this text One (Text Example), Two (Link to explanation). And here's what I need: so that when I click on the ListView link from the Two array opens.

  • It's hard - Gorets
  • I've been breaking my head for how many hours = ( - dayMe
  • I wrote to you that it is necessary to store an element in an array, but not pieces of lines .... - Gorets
  • I have no idea how to do this, show an example I will be glad - dayMe
  • Complaining about add The method add (Element) in the type of ArrayList <Element> is one.add (One.text ()); - dayMe

2 answers 2

 ArrayList<Element> one = new ArrayList(); for(Element newsheader : newsheaders){  Element One = newsheader.select("a[href]").first();  one.add(One); } 

So you keep the elements, pereberesh and pull out their values

  • Elements newsheaders = doc.select ("h2.newsheader"); ArrayList <Element> newsOrLink = new ArrayList (); for (Element newsheader: newsheaders) {Element TitleNews = newsheader.select ("a [href]"). first (); newsOrLink.add (TitleNews); } How to get the text now? newsOrLink.text ()? - dayMe
  • newsOrLink.get (0) .text (); like so from the first element. Would you teach java - Gorets
  • This is what I do) - dayMe

Look at the HashMap. As a key, store plain text, as a value, its explanation. Take .keySet() as the list model.