Open top menu

In this blog explain how to remove  empty index (null index)  from  ArrayList. Help you try this code

ArrayList<String>  itemids = new ArrayList<String>();

ItemNamelist.add("ItemName");
ItemNamelist.add(" "); // empty indiex
ItemNamelist.add(" ");
ItemNamelist.add(" ");
ItemNamelist.add("ItemName");


for(int i=0;i<itemids.size();i++)
{
     String value=itemids.get(i);
   // find not null string
     if(!value.equals("")){
     j=j+"~"+value;
}
}

Toast.makeText(getApplication() , j ,  oast.LENGTH_LONG).show();
Tagged

0 comments