Skip to content

Instantly share code, notes, and snippets.

View Drabu's full-sized avatar
🎯
Focusing

Burhan ud din Drabu

🎯
Focusing
View GitHub Profile
@Drabu
Drabu / AndroidManifest.xml
Created November 28, 2021 06:47 — forked from codinginflow/AndroidManifest.xml
Runtime Permission Request Tutorial
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.codinginflow.permissionrequestexample">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
private val classMap = mutableMapOf<String, Class<*>>()
private inline fun <reified T : Any> Any.castOrNull() = this as? T
internal fun <T> loadClassOrNull(className: String): Class<out T>? {
return classMap.getOrPut(className) {
try {
Class.forName(className)
} catch (e: ClassNotFoundException) {
return null