Example that should work for you:
Drawable buttonBackground = context.getResources().getDrawable(R.drawable.bg);
buttonBackground = buttonBackground.mutate();
//Set your filter here
More Related Contents:
- How to handle notification when app in background in Firebase
- How to manually include external aar package using Gradle for Android
- How to read file from res/raw by name
- How to simulate a touch event in Android?
- LinearLayout not expanding inside a ScrollView
- How do I rotate the Android emulator display? [duplicate]
- Android CalendarView for Showing Events
- Is there any limit of bundle in Android?
- Does the Android ART runtime have the same method limit limitations as Dalvik?
- Accessing UI thread handler from a service
- Android: Volley HTTP Request custom header
- How to add external fonts to android application
- Programmatically enter secret code like *#*#4636#*#* on Android
- Unable to cast Action Provider to Share Action Provider
- Firebase Authentication Not working in signed APK
- update sql database with ContentValues and the update-method
- Android Studio on a hardware that does not support virtualization technology
- How to add firebase-admin to my android project?
- Streaming Audio from A URL in Android using MediaPlayer?
- How do I change the background of an Android tab widget?
- Android Studio not showing Logcat with Flutter
- Send request over WiFi (without connection) even if Mobile data is ON (with connection) on Android M
- Draw a semicircle in the background of a View
- How to build OpenSSL as unversioned shared lib for Android?
- WiFi Direct (Android 4.0) with multiple (3+) devices
- Quick fix for NetworkOnMainThreadException
- Android, how do I stop a pointer appearing below an EditText
- Can I draw outside the bounds of an Android Canvas
- Text color of a closed spinner
- Kotlin: open new Activity inside of a Fragment