Casting List to List in java(android) -
Casting List<String> to List<ClassType> in java(android) -
how can cast list<string> list<headerinfo> headerinfo class name
public class headerinfo{   public headerinfo(list<string> list){}   public headerinfo(){} }  public someclass{   list<string> lables = new arraylist<string>();   lables = getalllabels();   list<headerinfo> lables1 = new arraylist<headerinfo>(lables); }    i wanted convert lables type list<headerinfo> can pass custom adapter
says undefined
i believe wanted following:
public someclass {     public list<headerinfo> getheaderinfos()     {          list<string> labels = getalllabels();          list<headerinfo> headerinfos = new arraylist<headerinfo>();          for(string label : labels)          {              headerlist.add(new headerinfo(label));          }           homecoming headerinfos;     } }    although here assumed headerinfo contains 1 string label. , constructor wrong in case. getalllabels() should homecoming
list<list<string>>    if not case.
 java android 
 
Comments
Post a Comment