我正在尝试检查每个项目的复选框,但应用程序不断崩溃。这是我的新成分: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; }); }}
3 回答
尚方宝剑之说
TA贡献1788条经验 获得超4个赞
带有 id 的复选框checkbox有一个带有名称的点击处理程序,clickHandler但它没有在 java 类中实现。
要么删除
android:onClick="clickHandler"
或将clickhandler方法添加到 java 类。
public void clickHandler(View view) {
}
添加回答
举报
0/150
提交
取消