I have this code...
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
final RelationShipAdapter adapter = null;
lvRelationShipAllUser.setOnItemClickListener(new AdapterView.OnItemClickListener(){
@Override
public void onItemClick(AdapterView<?> parent, View view, int i, long l) {
int test = i;
connectOrDisconnectUser(test);
}
});
lvRelationShipAllUser = (ListView) getView().findViewById(R.id.lvRelationShip);
lvRelationShipAllUser.setAdapter(adapter);
//context = BlankFragment.this;
return inflater.inflate(R.layout.relationship, container, false);
}
The error says:
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ListView.setOnItemClickListener(android.widget.AdapterView$OnItemClickListener)' on a null object reference
On this line:
lvRelationShipAllUser.setOnItemClickListener(new AdapterView.OnItemClickListener(){
Whats the issue....?
When it's in this own class (No Fragments) there is no issue.