the wrong messsage is " Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference". what I am trying to do is clicking one item on recycleView and jump to another page. the code is below:
public contactHolder(View itemView, Activity context) {
super(itemView);
this.context = context;
Fname = itemView.findViewById(R.id.getFname);
Lname = itemView.findViewById(R.id.getLname);
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startAnew(contactID);
}
});
}
private void startAnew(String currentcontactID) {
Intent intent = new Intent(context, personActivity.class);
intent.putExtra(CONTACT_ID,currentcontactID);
context.startActivity(intent);
}