我正在开发一个具有3个互相扩展的列表的应用程序。前两个列表正在工作,但是当单击第二个列表的项目进入第三个列表时,它会通过错误“ E / AndroidRuntime:致命异常:主要”而停止运行。列表正在从数据库中获取数据
我已经重新检查了变量并遍历了数据库,但是没有任何效果。
在这个模块上我得到了错误 lv.setOnItemClickListener(new AdapterView.OnItemClickListener(){
@Override public void onItemClick(AdapterView parent,View view,int position,long id){
Toast.makeText(SubCategoryCivilLaws.this,
Name_ArrayList.get(position), Toast.LENGTH_LONG).show();
switch (NAME_ArrayList.get(position)) {
case "Dishonest Investigation":{
Intent intent = new Intent(SubCategoryCivilLaws.this, DishonestInvestigation.class);
startActivity(intent);
break;
}
case "Offences":{
Intent intent = new Intent(SubCategoryCivilLaws.this, offences.class);
startActivity(intent);
break;
}
case "Unlawful Labour":{
Intent intent = new Intent(SubCategoryCivilLaws.this, unlawfulLabour.class);
startActivity(intent);
break;
}
case "Fraudulent":{
Intent intent = new Intent(SubCategoryCivilLaws.this, fraudulanent.class);
startActivity(intent);
break;
}
case "Usage of criminal force":{
Intent intent = new Intent(SubCategoryCivilLaws.this, forceUsage.class);
startActivity(intent);
break;
}
}
预期结果和实际结果是通过单击与任何上述情况匹配的项目,意图将移至下一个列表