I try to use a fragment to open a database, however, when I click the button to begin searching, the program unexpectedly terminates and it show the error like this:
I had this issue in my android activity.The mistake was my Toast was not getting the context or I would prefer to call it reference of the activity.
Previous code:-
Toast.makeText(context, "Session Expire..!", Toast.LENGTH_SHORT).show();
Corrected Code:-
Toast.makeText(activityname.this, "Session Expire..!", Toast.LENGTH_SHORT).show();