Ardalan
New Member
An "ActivityNotFoundException" occurs because there isn't an app installed on the device.
I don't want to use "Getinstalledpackages" which needs permission. I just want to handle "ActivityNotFoundException". In other words, if the application is installed on phone, startActivty () happens, otherwise shows the message "The application is not installed" instead of ActivityNotFoundException error message.
I have found Java codes. But I don't know how to use them in B4X. I try it but ActivityNotFoundException is not defined.
try {
// here is your code that can potentially throw the exception and the force crash
} catch (ActivityNotFoundException activityNotFound) {
Toast.makeText(this, "your error message", Toast.LENGTH_SHORT).show();
// maybe also log the exception, for future debugging?
}
Thank you for your answers in advance.
I don't want to use "Getinstalledpackages" which needs permission. I just want to handle "ActivityNotFoundException". In other words, if the application is installed on phone, startActivty () happens, otherwise shows the message "The application is not installed" instead of ActivityNotFoundException error message.
I have found Java codes. But I don't know how to use them in B4X. I try it but ActivityNotFoundException is not defined.
try {
// here is your code that can potentially throw the exception and the force crash
} catch (ActivityNotFoundException activityNotFound) {
Toast.makeText(this, "your error message", Toast.LENGTH_SHORT).show();
// maybe also log the exception, for future debugging?
}
Thank you for your answers in advance.