I am getting the Error message while i am trying to call the Toast.makeText function inside the onReceive function of the BroadcastReceiver type class. This is not a duplicate of another Question because i am calling the show() method and this is compile time issue Error is : cannot resolve method makeText.
The same function working fine if i am calling it inside any other Activity Type Class.
Here is my code that i am trying to run .
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
public class CallStateReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(this,"test", Toast.LENGTH_SHORT).show();
}
}