android studio get sdk code example

Example 1: android studio sdk

After the installation, immediately close Android Studio,then start it as administrator.
A message might popup asking for the sdk manager location.
Ignore it (Close the popup).
Go to Tools > SDK Manager and click on the edit button on the right of Android SDK Location.
Then click Next, next and you're good to go.
Android Studio will let you install the sdk manager.

Example 2: android get sdk version

if(android.os.Build.VERSION.SDK_INT ==  android.os.Build.VERSION_CODES.LOLLIPOP){
	// Code For Android Version higher equal to LOLLIPOP(21)
} else if(android.os.Build.VERSION.SDK_INT > 21){
	// Code For Android Version higher than LOLLIPOP(21)
} else{
	// Code For Android Version lower than LOLLIPOP(21)
}

Tags:

Misc Example