Posts

Showing posts from June, 2023

Call Intent | Android Studio | Kotlin

Image
Call Intent: We will use intent to open the dialer with the phone number the user entered. In this example, we will input a phone number using an input field i.e. EditText, and open that phone number in the dialer screen by clicking the button. >>Check For Java Code Snippet: val intent = Intent(Intent.ACTION_VIEW, Uri.parse( "tel:${Uri.encode(phone)}" )) startActivity(intent) Full Example: activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:app= "http://schemas.android.com/apk/res-auto" xmlns:tools= "http://schemas.android.com/tools" android:layout_width= "match_parent" android:layout_height= "match_parent" android:gravity= "center" android:orientation= "vertical" android:padding= "20dp" tools:context= ".MainActivity1" > ...

Call Intent | Android Studio | Java

Image
Call Intent: We will use intent to open the dialer with the phone number the user entered. In this example, we will input a phone number using an input field i.e. EditText, and open that phone number in the dialer screen by clicking the button. >>Check For Kotlin Code Snippet: Intent intent = new Intent ( Intent . ACTION_VIEW , Uri . parse ( "tel:" + Uri . encode ( phone ))); startActivity ( intent ); Full Example: activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:app= "http://schemas.android.com/apk/res-auto" xmlns:tools= "http://schemas.android.com/tools" android:layout_width= "match_parent" android:layout_height= "match_parent" android:gravity= "center" android:orientation= "vertical" android:padding= "20dp" tools:context= ...