mirror of
https://github.com/SimpleMobileTools/Simple-Launcher.git
synced 2025-06-05 21:59:15 +02:00
launch the clicked app on clicking its icon
This commit is contained in:
@ -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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user