Rajubhai Rathod Rajubhai Rathod - 1 year ago 74
Java Question

ContextCompat is not applicable for the arguments

I am trying to implement permission method on one of my menu in android application but its giving me error like below

The method checkSelfPermission(Context, String) in the type ContextCompat is not applicable for the arguments (new BottomSheetListener(){}, String)

My code for this menu is like below

else if(menuItem.getItemId() == R.id.save_image) {

int gpermission = ContextCompat.checkSelfPermission(this,

if (gpermission != PackageManager.PERMISSION_GRANTED) {



Please check and let me know if someone can help me :)

Thanks :)

Answer Source

If this code is in a Activity class, write :


instead of this, else get the context from the parent Activity and use it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download