aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-12-16 15:33:14 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-12-16 15:33:14 +0100
commitb584c8fa7390dd047ce29c4a2a69190ccbb17d4e (patch)
tree9c9d5bad94d998b594ae03c58d3f385b5e7b72ab
parent8fb966295943a0749fd409f965f8548db516a742 (diff)
parentf4e81f8ca53eae6186dc85b2ac46e45d0c2b2b7e (diff)
Merge remote-tracking branch 'origin/stable' into dev
-rw-r--r--src/androidextras/doc/qtandroidextras.qdocconf1
-rw-r--r--src/androidextras/doc/snippets/code/src_androidextras_qandroidjniobject.cpp16
-rw-r--r--src/androidextras/jni/qandroidjniobject.cpp4
3 files changed, 11 insertions, 10 deletions
diff --git a/src/androidextras/doc/qtandroidextras.qdocconf b/src/androidextras/doc/qtandroidextras.qdocconf
index 91d7488..c1f7806 100644
--- a/src/androidextras/doc/qtandroidextras.qdocconf
+++ b/src/androidextras/doc/qtandroidextras.qdocconf
@@ -33,6 +33,7 @@ headerdirs += ..
sourcedirs += ..
exampledirs += ../../../examples/androidextras \
snippets
+examples.fileextensions += *.java
# Specify example install dir under QT_INSTALL_EXAMPLES
examplesinstallpath = androidextras
diff --git a/src/androidextras/doc/snippets/code/src_androidextras_qandroidjniobject.cpp b/src/androidextras/doc/snippets/code/src_androidextras_qandroidjniobject.cpp
index 6f545fb..f690d63 100644
--- a/src/androidextras/doc/snippets/code/src_androidextras_qandroidjniobject.cpp
+++ b/src/androidextras/doc/snippets/code/src_androidextras_qandroidjniobject.cpp
@@ -41,13 +41,13 @@
//! [Working with lists]
QStringList getTrackTitles(const QAndroidJniObject &album) {
QStringList stringList;
- QAndroidJniObject list = album.callObjectMethod<jobject>("getTitles",
+ QAndroidJniObject list = album.callObjectMethod("getTitles",
"()Ljava/util/List;");
if (list.isValid()) {
const int size = list.callMethod<jint>("size");
for (int i = 0; i < size; ++i) {
- QAndroidJniObject title = list.callObjectMethod<jobject>("get", "(I)Ljava/lang/Object;", i);
+ QAndroidJniObject title = list.callObjectMethod("get", "(I)Ljava/lang/Object;", i);
stringList.append(title.toString());
}
}
@@ -56,12 +56,12 @@ QStringList getTrackTitles(const QAndroidJniObject &album) {
//! [Working with lists]
//! [QAndroidJniObject scope]
-void function()
+void functionScope()
{
QString helloString("Hello");
jstring myJString = 0;
{
- QAndroidJniObject string = QAndroidJniObject::fromString(string);
+ QAndroidJniObject string = QAndroidJniObject::fromString(helloString);
myJString = string.object<jstring>();
}
@@ -70,7 +70,7 @@ void function()
//! [QAndroidJniObject scope]
//! [Check for exceptions]
-void function()
+void functionException()
{
QAndroidJniObject myString = QAndroidJniObject::fromString("Hello");
jchar c = myString.callMethod<jchar>("charAt", "(I)C", 1000);
@@ -103,7 +103,7 @@ void registerNativeMethods() {
QAndroidJniObject javaClass("my/java/project/FooJavaClass");
QAndroidJniEnvironment env;
- jclass objectClass = env->GetObjectClass(javaClass)
+ jclass objectClass = env->GetObjectClass(javaClass.object<jobject>());
env->RegisterNatives(objectClass,
methods,
sizeof(methods) / sizeof(methods[0]));
@@ -112,8 +112,8 @@ void registerNativeMethods() {
void foo()
{
- QAndroidJniObject::callStaticMethod("my/java/project/FooJavaClass", "foo", "(I)V", 10); // Output: 10 < 100
- QAndroidJniObject::callStaticMethod("my/java/project/FooJavaClass", "foo", "(I)V", 100); // Output: 100 >= 100
+ QAndroidJniObject::callStaticMethod<void>("my/java/project/FooJavaClass", "foo", "(I)V", 10); // Output: 10 < 100
+ QAndroidJniObject::callStaticMethod<void>("my/java/project/FooJavaClass", "foo", "(I)V", 100); // Output: 100 >= 100
}
//! [Registering native methods]
diff --git a/src/androidextras/jni/qandroidjniobject.cpp b/src/androidextras/jni/qandroidjniobject.cpp
index 1057650..141d604 100644
--- a/src/androidextras/jni/qandroidjniobject.cpp
+++ b/src/androidextras/jni/qandroidjniobject.cpp
@@ -156,7 +156,7 @@ QT_BEGIN_NAMESPACE
\li Signature
\row
\li jobject
- \li {1, 3} L\e<fully-qulified-name>};
+ \li {1, 3} L\e<fully-qulified-name>;
\row
\li jclass
\row
@@ -359,7 +359,7 @@ QT_BEGIN_NAMESPACE
\code
QAndroidJniObject myJavaString; ==> "Hello, Java"
- QAndroidJniObject mySubstring = myJavaString.callObjectMethod<jstring>("substring", "(II)Ljava/lang/String;" 7, 10);
+ QAndroidJniObject mySubstring = myJavaString.callObjectMethod("substring", "(II)Ljava/lang/String;" 7, 10);
\endcode
*/