Reputation: 190
I am trying to invoke the method ActivityCompat.checkSelfPermission(context, permissionfrom)
inside an inner class. Outer class is inherited from android.app.Activity
and inner class is not an inherited class. My problem is what variable should I give for the first argument context
in the method.
I am new to android and couldn't find a solid answer for this. if call the method inside the outer class, this
can be used as an argument? But, what happens if I invoke the method inside the inner class ?
Upvotes: 1
Views: 1303
Reputation: 2411
You should use ActivityCompat.checkSelfPermission(YourActivityName.this, permissionfrom)
, like this. Here, YourActivityName
should be replaced by your Outer class name.
Upvotes: 2
Reputation: 472
Pass as context- {name of your outer class}.this
Hope this helps
Upvotes: 0