launch the clicked app on clicking its icon

This commit is contained in:
tibbi
2022-09-17 21:23:12 +02:00
parent 69dc2bcfcd
commit 05484a5b29
5 changed files with 45 additions and 12 deletions

View File

@ -0,0 +1,13 @@
package com.simplemobiletools.launcher.extensions
import android.app.Activity
import com.simplemobiletools.commons.extensions.showErrorToast
fun Activity.launchApp(packageName: String) {
val launchIntent = packageManager.getLaunchIntentForPackage(packageName)
try {
startActivity(launchIntent)
} catch (e: Exception) {
showErrorToast(e)
}
}