Posts

Showing posts from September, 2025

Bitmap from View | Android Studio | Compose

Image
How to get and save the screenshot of a specific part of the Screen? In this tutorial, we will learn how to get the Bitmap from any UI View and Save it to Storage/Gallery. For Example, we have a LinearLayout containing some child views such as ImageView(s), TextView(s), and maybe some more UI Views. On clicking a button we will save that LinearLayout as an image in storage/gallery. So by learning this technique you can save any UI View or Layout as an image in Storage/Gallery. >> Check For Java >> Check For Kotlin >> Check For Compose Code: MaintActivity.kt package com.technifysoft.myapplication import android.content.ContentValues import android.content.Context import android.graphics.Bitmap import android.graphics.Rect import android.net.Uri import android.os.Bundle import android.os.Environment import android.provider.MediaStore import android.widget.Toast import androidx.activity.ComponentActivity import androidx.activity.compose.setCon...

Generate Random Color - Android Studio - Compose

Image
Generate random color(s) using Android Studio and Jetpack Compose There may be some situations in which you need the feature to generate a random color.  For example, in a list of items, if you want to assign different colors to each item/row, you may have seen the WhatsApp Group Chat List, where each person's name is displayed in a different color.  I'll do it using a button click. You can do it according to your requirements/needs. >> View for Java >> View for Kotlin >> View for Compose Code Code Snippet val generatedColor = Color( Random. nextInt ( 256 ), Random. nextInt ( 256 ), Random. nextInt ( 256 ) ) Full Example MainActivity.kt package com.technifysoft.myapplication import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.foundation.background import androidx.compose...

Call Intent - Android Studio - Compose

Image
Open Call Intent with Phone Number using Android Studio and Jetpack Compose 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 >> Check for Kotlin >> Check for Compose Code Snippet: Intent intent = new Intent ( Intent . ACTION_VIEW , Uri . parse ( "tel:" + Uri . encode ( phone ))); startActivity ( intent ); Full Example: MainActivity.kt package com.technifysoft.myapplication import android.content.Context import android.content.Intent import android.net.Uri import android.os.Bundle import android.widget.Toast import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.la...

SMS Intent - Android Studio - Compose

Image
Open SMS Intent with Phone Number using Android Studio and Jetpack Compose Learn how to create a simple SMS sending feature in Android using Android Studio with Kotlin Jetpack Compose. This tutorial shows how to build a clean UI with an input field for phone numbers and a button that opens the SMS app with the entered number. A step-by-step guide with Kotlin code for beginners and developers moving from XML layouts to Compose. >> Check For Java >> Check for Kotlin >> Check for Compose Code Snippet val intent = Intent(Intent. ACTION_VIEW , ( "sms:" + Uri. encode (phone)). toUri ()) context. startActivity (intent) Full Example MainActivity.kt package com.technifysoft.myapplication import android.content.Context import android.content.Intent import android.net.Uri import android.os.Bundle import android.widget.Toast import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.fou...