主activity報空指標異常java.lang.RuntimeException: Unable to resume activity
主activity 報空指標異常
java.lang.RuntimeException: Unable to resume activity {com.click369.test/com.click369.test.jzactivity.TallyToolActivity}: java.lang.NullPointerException
問題原因是
setAdapter(asapter);為空 有一種情況是id重複
主activity 包含的fragment的listview為空導致
原被 包含的fragment的onCreateView程式碼
public class RuzhangFragment extends Fragment{
private ListView rulistView1 = null;//收入介面的listview
private List<RuZhang> ruzhanglist = null;// 記錄訊息集合
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View ruzhangView=inflater.inflate(R.layout.ruzhanglist_layout, null, false);
return ruzhangView;
}
}
修改後
public class RuzhangFragment extends Fragment{
private ListView rulistView1 = null;//收入介面的listview
private List<RuZhang> ruzhanglist = null;// 記錄訊息集合
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View ruzhangView=inflater.inflate(R.layout.ruzhanglist_layout, null, false);
//進入之後顯示收入賬單 有內容顯示的Listview。
rulistView1=(ListView)ruzhangView.findViewById(R.id.rulistView1);
return ruzhangView;
}
}