我正在尝试检查每个项目的复选框,但应用程序不断崩溃。
这是我的新成分:
public class NewIngredients extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_new_ingredients);
readCSV ();
}
public void readCSV(){
List<IngredientsHolder> data = new ArrayList<> ();
try {
String sCurrentline = null;
BufferedReader br = new BufferedReader(new FileReader ("/sdcard/TABLE_BF.csv"));
sCurrentline = br.readLine ();
while ((sCurrentline = br.readLine()) != null) {
String[] arr = sCurrentline.split(",");
IngredientsHolder ingredient = new IngredientsHolder(arr[0], arr[1], arr[2]);
data.add(ingredient);
}
br.close();
} catch (IOException e) {
e.printStackTrace();
}
Map<String, List<IngredientsHolder>> ingredientsByName = data.stream().collect(Collectors.groupingBy(IngredientsHolder::getName));
List<IngredientsHolder> main = new ArrayList<>();
List<IngredientsHolder> other = new ArrayList<>();
//Sort on `admin` in descending order
Comparator<IngredientsHolder> comparator = Comparator.comparing(IngredientsHolder:: getAdmin, (i1, i2) -> {
if (i2 > i1) {
return -1;
} else if (i2 < i1) {
return 1;
}
return 0;
});
}
}
桃花长相依
尚方宝剑之说
精慕HU
相关分类