display items from an xml file when condition is satisfied
<p>I have a problem of comparaison </p>

<pre><code>    for (int i = 0; i &lt; posteList.getgouvernorat().size(); i++) {   
            if (posteList.getgouvernorat().get(i).toString()==text){
            gouvernorat[i] = new TextView(this);
            gouvernorat[i].setText("gouvernorat = "+posteList.getgouvernorat().get(i));
            ville[i] = new TextView(this);
            ville[i].setText("ville = "+posteList.getville().get(i));
            localite[i] = new TextView(this);
            localite[i].setText("localite = "+posteList.getlocalite().get(i));
        }
layout.addView(gouvernorat[i]);
    layout.addView(ville[i]);
    layout.addView(localite[i]);
    String b="-------------------";
    }
    a = new TextView(this);
    a.setText(text);
    layout.addView(a);

    /** Set the layout view to display */
    setContentView(layout);
    }
}
</code></pre>

<p>gouvernorat[i] is an arrayList</p>

<p>text is a String</p>

<p>this code display an error message <code>Sorry Force Close</code></p>

<p>i used XML parser, and the code is to parse the xml file </p>

<p>i want to display on a layout only the item equal to text</p>

<p>when i remove the test <code>if (posteList.getgouvernorat().get(i).toString()==text)</code> all the file will be displayed</p>

<p>thank you in advance</p>
