Use ContextCompat.getSystemService() and the Context.getSystemService() extension function.

This commit is contained in:
Isira Seneviratne 2020-09-13 17:20:29 +05:30
parent cdb6e718f7
commit 3da55d9f40
17 changed files with 61 additions and 43 deletions

View file

@ -201,7 +201,7 @@ public class Utility {
}
public static void copyToClipboard(Context context, String str) {
ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipboardManager cm = ContextCompat.getSystemService(context, ClipboardManager.class);
if (cm == null) {
Toast.makeText(context, R.string.permission_denied, Toast.LENGTH_LONG).show();