Today I installed latest version of Android Studio
I am learning Floating Widgets in Android
I started with applying this example
https://www.spaceot
This is occurring because the targetSdkVersion in the example and your targetSdkVersion are different. Use the flag TYPE_APPLICATION_OVERLAY instead of TYPE_PHONE in WindowManager.LayoutParams:
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY