I want to change text in textview which is in a listview on click
listViewMessage = (ListView) rootview.findViewById(R.id.listView);
listViewMessage.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {
txtViewMess = (TextView) listViewMessage.getChildAt(position).findViewById(R.id.textViewMessage); //error
txtViewMess.setText("Paid");
}
});
Code worked for a couple of textview, but some turned to
java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference