Posts

Showing posts from July, 2018

Spinner | Android Studio | Java

Image
Spinner Example | Android Studio | Java In this tutorial, we will learn how to use Spinner. Android spinner is like the drop-down menu with multiple values from which the end-user can select only one value. Android spinner is associated with AdapterView. So you need to use one of the adapter classes with spinner. We will select an item from the Spinner and set it to the TextView. >>Watch For Kotlin Step 1:  Create a new project   OR   Open your project Step 2: Code activity_main.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout 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:padding= "5dp" tools:context= ".MainActivity" ...

Bluetooth Example

Image
Using BluetoothAdapter class we will do the following operations Check if Bluetooth is available or not. Turn On/Off Bluetooth. Make Bluetooth Discoverable. Display Paired/Bounded devices. Note: The getBoundedDevices() method of BluetoothAdapter class provides a set containing list of all paired or bounded bluetooth devices. Permissions Required: BLUETOOTH, BLUETOOTH_ADMIN Step 1:  Create a new project   OR   Open your project Step 2:  Add 2 Images to show Bluetooth status icons Step 3:  Add  BLUETOOTH, BLUETOOTH_ADMIN  permission in AndroidMenifest.xml Step 4: Code AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android= "http://schemas.android.com/apk/res/android" package= "com.blogspot.atifsoftwares.bluetoothexample" > <uses-permission android:name= "android.permission.BLUETOOTH" /> <uses-permission android:na...

Check Network Status - Android Studio - Java

Image
How to check Network Connection Status In this tutorial, you will learn how to detect the type of internet connection in an Android app using Java. We will check whether the device has no internet connection , is connected through Wi-Fi , or is using Mobile Data . This is a common feature in modern Android applications to improve user experience and handle offline scenarios smoothly. By the end of this guide, you’ll understand how to access the Android network services, detect connection status programmatically, and display meaningful messages to users based on their connectivity state. >> Check For Java >> Check For Kotlin >> Check For Compose Code: AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http://schemas.android.com/tools" > <uses-permission android:name= "android.permission.ACCESS_NETWORK_ST...