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

Image
Check Network Status – Android Studio Tutorial In this tutorial we will check internet connection like: No internet connection Connected with Wifi Connected with Mobile Data Check Network Status Step 1:  Create a new project   OR   Open your project Step 2: Add 3 Images to show networks status icons Step 3: Add ACCESS_NETWORK_STATE 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.networconnectionstatus" > <uses-permission android:name= "android.permission.ACCESS_NETWORK_STATE" /> <application android:allowBackup= "true" android:icon= "@mipmap/ic_launcher" android:label= "@string/app_name" android:roundIcon= "@mipmap/ic_launcher