Flashlight
Flashlight:
Using the context of the different environments in mobile devices a flashlight is understood as the LED bulb on the rear side of the device which can be used to provide light. This feature is present on most of the developing mobile operating systems for smartphones and more recently for tablets with a rear camera.
The flashlight can be switched to bright mode, where light emitted by the orb will be focused giving it the appearance of a traditional flashlight.
Example:
// AndroidManifest.xml:
<uses-feature android:name="android.hardware.camera.flash" />
<?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"
tools:context=".MainActivity"
android:layout_gravity="center"
android:gravity="center"
android:padding="16dp">
<TextView
android:id="@+id/textFlashlight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Flashlight OFF"
android:textStyle="bold"
android:textSize="28sp"
android:textColor="#000000"
android:padding="16dp"
android:layout_marginBottom="20dp"
/>
<ToggleButton
android:layout_below="@id/textFlashlight"
android:id="@+id/flashlightButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Flashlight"
android:textSize="16sp"
android:textColor="#FFFFFF"
android:padding="16dp"
android:background="@color/colorPrimaryDark"
/>
</RelativeLayout>