java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference [duplicate]

杀马特。学长 韩版系。学妹 提交于 2019-12-02 11:02:12
Blackbelt

The parameter in one of addProject* method is null. As you can see in the snippet from ArrayAdapter.createViewFromResource:

T item = getItem(position);
if (item instanceof CharSequence) {
   text.setText((CharSequence)item);
} else {
   text.setText(item.toString());
}

...the check for instanceof Charsequence, which return false if T is not a CharSequence or if T is null. Since your Adapter is of type String we can exclude the first case. So one of the String in your collection is null.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!