사용자 지정 배열 어댑터를 사용하여 연락처 목록을 표시하려고했습니다. com.example.contactsapp.ContactsListAdapter.getView (ContactsListAdapter.java:37)에서사용자 지정 목록 어댑터에서 Null 포인터 예외가 발생했습니다.
java.lang.NullPointerException이
이 내 사용자 정의 목록이다 : 그러나 나는 내 응용 프로그램을 실행할 때마다 나는 다음과 같은 오류가 발생합니다 어댑터 클래스 :
:public class ContactsListAdapter extends ArrayAdapter<Contact> {
List <Contact> people;
//Contact c;
TextView name;
TextView email;
public ContactsListAdapter(Context context, List<Contact> people) {
super(context, R.layout.list_row, people);
this.people = people;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if(v == null){
LayoutInflater inflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.list_row, null);
}
Contact c = this.people.get(position);
name = (TextView)v.findViewById(R.id.namebox);
name.setText(c.getName());
email = (TextView)v.findViewById(R.id.emailbox);
email.setText(c.getEmail());
return v;
}
}
이 내 ListView에 활동이다
}
아이디어가 있으십니까?
줄 37은 무엇입니까? – petey