I have an HTML that looks something like this
<div class="copy>
<p>First tip</p>
<p><span style="FONT-SIZE:medium"><br/></span></p>
<p>Second Tip</p>
<p> </p>
<p>Third tip</p>
<p> </p>
<p>Fourth tip</p>
</div>
I'm using Jsoup to extract the text inside the p elements and store them in an arraylist. But I don't want to store the ones that don't have any text in them . I've tried the following but it doesn't work.
Elements tips = doc.select("div.copy > p");
for(Element tip: tips) {
if(tip.text() != "") {
if(tip.text() != " ") {
tipsArray.add(tip.text());
}
}
}
The code doesn't add the second p element with the br tag in the arraylist but it isn't working for  . I'm trying to use the arraylist on a listview in Android. I've also tried using \u00a0 instead of   inside the if statement but that doesn't work either.Is there another way of doing this or am I doing something wrong? I don't know if this problem is Java -related or Android-related. Thanks for any help.