My application loads various shared objects when created. I would like to catch errors thrown because of the shared objects not being present on the device and show a better error message to the user. How do I achieve this?
I can catch the java.lang.UnsatisfiedLinkError
like so
static
{
try
{
System.loadLibrary("MyApplication");
}
catch(java.lang.UnsatisfiedLinkError e)
{
if(e.getMessage().contains("libSharedObject"))
{
Log.e( TAG, "This device does not support ..." );
}
else
{
throw e;
}
}
}
But Toast.makeText(...).show()
and other application message boxes won't work because the application will die in onCreate()
because of the previous error.
Is there a way of changing the systems default error message of "Unfortunately there was an error.."? Or a way of displaying an error message with another process or the Android OS?