very new to Android programming. Despite of all my search I couldn't find how to write SDK specified code blocks in Android Studio.
For example, as far as I learnt so far there are different types of Notifications depending on the target SDK version.
I want to keep the minSDKversion as low as possible (9 for my case) but I also want to create 3 different functions for the higher versions of SDK in order to support modernest type notifications like this:
createNotificationForSKD9(String msg) {
//code to show older-type notification for API level 9
}
createNotificationForSKD16(String msg) {
//code to show notification for API level 16
}
createNotificationForSKD21(String msg) {
//code to show newer-type notification for API level 21
}
But when I do this, Android Studio gives compile errors because my minSDKlevel has been set to 9 but I wrote some code for the SDK version above 9.
So, what is the workaround for this ?
Thanks by now.