I have a variable “ekinismi”. And when I add String(s) to it. I receive the “eklist” from another activities with EkinIsmi() method.
static List<String> eklist = new ArrayList<String>();
public List<String> EkinIsmi()
{
return eklist;
}
But this list return me “null” and my list items. But I just want to receive only list items. How can I do that with a for loop or something. Null(s) are not String so I can’t use equals or compareto for split the null(s) from my list.
This code sample is working good for me, but as you see, I give the list items number to the “i”. But it has to understand what the list has.
if(ekinismi.size() > 1)
{
for(int i=ekinismi.size()-1; i>ekinismi.size()-3; i--)
dosyaAdi.setText(String.valueOf(ekinismi.get(i)));
}

I click the position = 0 list item and then click the next one and at the dosyaAdi.setText() is set first and next one’s “s” . I mean I need to clear all the list items. Because it holds the first one’s. Where should I put the list.clear()? Actually, I already do that but it didn’t change anything, I think maybe I put it to wrong line.
List<String> list = new ArrayList<String>();
if( ekvarmı == true)
{
if(ekinismi.size() >= 1)
{
for(String s : ekinismi)
{
if(s != null)
{
list.add(s);
}
}
dosyaAdi.setText(String.valueOf(list));
}
}
1 Answer