Showing posts from February, 2019

Translucent and Transparent Background for Activity

We are already familiar that an Activity in Android is a single screen on the device but in this article, we will learn how to make it transparent and translucent. 1. Open styles.xml and add the background theme. <!-- Background Theme for Activity --> <style name="AppTheme.NoActionBar.TranslucentBackground" parent="AppTheme.NoActionBar"> <item name="android:windowBackground">@color/colorBackgroundPromotions</item> <item name="android:windowIsTranslucent">true</item> <item name="colorPrimaryDark">@color/colorBackgroundPromotions</item> <item name="android:windowTranslucentStatus">true</item> </style> Set windowIsTranslucent and windowTranslucentStatus tags to true . As the name implies, windowBackground is the background color for an activity and is set to a custom color. Overriding the colorPrimaryDark will make the status bar tra

How to Set an Android App as a Default Dialer

A default dialer is an application that handles the Phone calls on the device. Google made the provision for third-party applications to be a default phone handler from SDK 23 (6.0, Marshmallow version). In the article, we will learn about how to set our Android application as a default dialer. 1) Add the below intent filters under the activity tag in the AndroidManifest.xml. <intent-filter> <action android:name="android.intent.action.DIAL"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> <intent-filter> <action android:name="android.intent.action.DIAL"/> <category android:name="android.intent.category.DEFAULT"/> <data android:scheme="tel"/> </intent-filter> 2) Check if our application is already a default dialer app using TelecomManager. val telecomManager = getSystemService(Context.TELECOM_SERVICE) as TelecomManager Log