Fix NullPointerException

This commit is contained in:
Przemek Grondek 2014-10-14 09:39:26 +02:00
parent 534824c1c9
commit 0a37de8e2b

View file

@ -33,7 +33,13 @@ public class ElementArrayAdapter extends ArrayAdapter<String> {
super(context, resource, fields); super(context, resource, fields);
init(context, resource, fields); init(context, resource, fields);
this.values = new ArrayList<String>(); this.values = new ArrayList<String>();
if(values!=null) {
this.values.addAll(values); // Copy this.values.addAll(values); // Copy
} else {
for(int i=0;i<fields.size();i++){
this.values.add(new String());
}
}
} }
private void init(Context context, int resource, List<String> fields){ private void init(Context context, int resource, List<String> fields){