Get current location with latitude and longtitude using kotlin

<ol> <li>This tutorial about get current location with latitude and longtitude using kotlin.</li> </ol> <p>2. Add permission in manifest</p> <pre> &lt;<strong>uses-permission android:name=&quot;android.permission.ACCESS_COARSE_LOCATION&quot; </strong>/&gt; &lt;<strong>uses-permission android:name=&quot;android.permission.ACCESS_FINE_LOCATION&quot; </strong>/&gt;</pre> <p>3. xml layout</p> <pre> <em>&lt;?</em><strong>xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;</strong><em>?&gt; </em>&lt;<strong>RelativeLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot; xmlns:tools=&quot;http://schemas.android.com/tools&quot; android:layout_width=&quot;match_parent&quot; android:layout_height=&quot;match_parent&quot; android:padding=&quot;4dp&quot; tools:context=&quot;.MainActivity&quot;</strong>&gt; &lt;<strong>TextView android:id=&quot;@+id/text&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:layout_centerHorizontal=&quot;true&quot; android:layout_marginTop=&quot;70dp&quot; android:background=&quot;#008080&quot; android:padding=&quot;5dp&quot; android:text=&quot;Hello World&quot; android:textColor=&quot;#fff&quot; android:textSize=&quot;24sp&quot; android:textStyle=&quot;bold&quot; </strong>/&gt; &lt;<strong>TextView android:id=&quot;@+id/textView&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:layout_centerInParent=&quot;true&quot; android:text=&quot;Get GPS Location&quot; android:textColor=&quot;@android:color/holo_red_dark&quot; android:textSize=&quot;24sp&quot; android:textStyle=&quot;bold&quot; </strong>/&gt; &lt;<strong>Button android:id=&quot;@+id/getLocation&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:layout_below=&quot;@+id/text&quot; android:layout_centerInParent=&quot;true&quot; android:layout_marginTop=&quot;40dp&quot; android:text=&quot;Get location&quot; </strong>/&gt; &lt;/<strong>RelativeLayout</strong>&gt;</pre> <p>4. kotlin code when click on button display latitude and longtitude in textview</p> <p><a href="https://medium.com/@hasperong/get-current-location-with-latitude-and-longtitude-using-kotlin-2ef6c94c7b76">Visit Now</a></p>