Android: Fix QAndroidPlatformServices::openUrl().
Return true only if an activity was found for the intent. Task-number: QTBUG-34716 Change-Id: I764caf1e8afa3b17b2d71f52873c17e5d834a956 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>bb10
parent
682976def7
commit
4946ed0496
|
|
@ -108,15 +108,20 @@ public class QtNative
|
|||
}
|
||||
}
|
||||
|
||||
public static void openURL(String url)
|
||||
public static boolean openURL(String url)
|
||||
{
|
||||
boolean ok = true;
|
||||
|
||||
try {
|
||||
Uri uri = Uri.parse(url);
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||
activity().startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
ok = false;
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
// this method loads full path libs
|
||||
|
|
|
|||
|
|
@ -54,11 +54,10 @@ QAndroidPlatformServices::QAndroidPlatformServices()
|
|||
bool QAndroidPlatformServices::openUrl(const QUrl &url)
|
||||
{
|
||||
QJNIObjectPrivate urlString = QJNIObjectPrivate::fromString(url.toString());
|
||||
QJNIObjectPrivate::callStaticMethod<void>(QtAndroid::applicationClass(),
|
||||
"openURL",
|
||||
"(Ljava/lang/String;)V",
|
||||
urlString.object());
|
||||
return true;
|
||||
return QJNIObjectPrivate::callStaticMethod<jboolean>(QtAndroid::applicationClass(),
|
||||
"openURL",
|
||||
"(Ljava/lang/String;)Z",
|
||||
urlString.object());
|
||||
}
|
||||
|
||||
bool QAndroidPlatformServices::openDocument(const QUrl &url)
|
||||
|
|
|
|||
Loading…
Reference in New Issue