Today’s News
- Planning Qt Contributors Summit
The second edition of the Qt Contributors Summit is warming up. Venue and dates are secured: June 21-23 in Berlin. Some sponsors have already stepped in and more will come. The schedule is being discussed as we speak but in any case it’s all about technical sessions based on status sharing, planning and discussion. It’s [...]
Digest powered by RSS Digest
Share and Enjoy
Today’s News
- Planning Qt Contributors Summit
The second edition of the Qt Contributors Summit is warming up. Venue and dates are secured: June 21-23 in Berlin. Some sponsors have already stepped in and more will come. The schedule is being discussed as we speak but in any case it’s all about technical sessions based on status sharing, planning and discussion. It’s [...]
Digest powered by RSS Digest
Share and Enjoy
Today’s News
- Qt SDK 1.2.1 update released
The Qt SDK 1.2.1, is now available for download. It brings increased stability to the Qt SDK 1.2. The updated SDK includes: Qt 4.8.1 desktop installers for Mac and Windows in addition to Qt source packages. Qt 4.8.1 is the first patch release to the 4.8 series with over 200 functional improvements to the desktop [...]
Digest powered by RSS Digest
Share and Enjoy
Today’s News
- Qt 5 Alpha is here – providing a taste of the future
Trolltech released Qt 4 almost seven years ago, and today the community is celebrating the first joint release of Qt 5 Alpha under the Qt Project umbrella. Nokia continues to be a key stakeholder and now the work done by Nokia is increased and supplemented by the efforts of Qt developers in other companies and [...]
Digest powered by RSS Digest
Share and Enjoy
Today’s News
- Qt 4.8.1 libraries for Windows, Mac and Linux/X11 released as stand-alone download
Today we release the Qt 4.8.1 libraries for those of you that target Windows, Mac and Linux/X11. The stand-alone download of the Qt 4.8.1 libraries will be followed, in the coming weeks, by a Qt SDK update including the updated Qt 4.8.1 libraries as well as updates in form of primary maintenance work on the [...]
Digest powered by RSS Digest
Share and Enjoy
Today’s News
- A year of Qt ecosystem growth with Digia nurturing Qt Commercial
A year ago Nokia and Digia announced the transfer of the Qt Commercial licensing business and the related team. This move was something completely new in the history of Qt, since the dual licensing model had been the base of Trolltech’s business from day one. A year later, all parties can consider this move as [...]
- mixd.tv — leveraging Qt Quick for a rich desktop UI (from a Python back-end)
Discovering new things to watch was once a simple glance at the TV listings, or channel hopping in an idle moment. Today, new video lives on an ever-growing list of Internet video channels, and the volume of new content arriving in those channels is growing daily. This is a challenge that Berlin based developers of [...]
Digest powered by RSS Digest
Share and Enjoy
Today’s News
- 20 companies showing Qt at IPTV World Forum
Tomorrow one of the world’s top Broadcast events, IPTV World Forum , opens in London, and more than 20 companies are showing Set-Top Boxes (STBs) powered by Qt. These companies use Qt in all its flavours. Increasingly STB makers are looking to Qt Quick to build innovative UIs with a richer user experience, whereas Telecom and broadcast [...]
Digest powered by RSS Digest
Share and Enjoy
Today’s News
- Recruiting Qt developers
Many companies act like there is a great wall of China between professional developers and developer communities when recruiting. They don’t dare to tutor students, have interns or aid free software projects. They’re afraid, don’t see the benefits, and argue that everything should be kept separate. In doing this they are dismissing an excellent way [...]
Digest powered by RSS Digest
Share and Enjoy
Qt Android (Necessitas) soft-keys control volume.
To control application volume from Necessitas the following changes are required into QtActivity.java file
import android.media.AudioManager;
public class QtActivity extends Activity
{
private AudioManager audio;
........
}
and add into public boolean onKeyDown(int keyCode, KeyEvent event) following code:
public boolean onKeyDown(int keyCode, KeyEvent event)
{
switch (keyCode) {
case KeyEvent.KEYCODE_VOLUME_UP:
audio.adjustStreamVolume(AudioManager.STREAM_MUSIC,
AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI);
return true;
case KeyEvent.KEYCODE_VOLUME_DOWN:
audio.adjustStreamVolume(AudioManager.STREAM_MUSIC,
AudioManager.ADJUST_LOWER, AudioManager.FLAG_SHOW_UI);
return true;
}
............
}
Share and Enjoy
How to use Java from Qt/C++ in Necessitas
This steps are valid for Necessitas Alpha 3 Update 4
Add your java class inside org.kde.necessitas.origo (i will refer in this article as JavaManager.Java)
Edit qtmain_android.cpp
Replace
static JavaVM *m_javaVM = NULL;
static JNIEnv *m_env = NULL;
static jobject objptr;
with
JavaVM *m_javaVM = NULL;
static JNIEnv *m_env = NULL;
jobject objptr;
//new pointer to my Java class
jobject customClassPtr;
//my class
static const char * const customClass = "org/kde/necessitas/origo/JavaManager";
Add next lines to your file
static int registerNativeMethodsCustom(JNIEnv* env, const char* className,
JNINativeMethod* gMethods, int numMethods)
{
jclass clazz=env->FindClass(className);
if (clazz == NULL)
{
__android_log_print(ANDROID_LOG_FATAL,"Qt", "Custom Native registration unable to find class '%s'", className);
return JNI_FALSE;
}
jmethodID constr = env->GetMethodID(clazz, "
if(!constr) {
__android_log_print(ANDROID_LOG_FATAL,"Qt", "Custom Native registration unable to find constructor for class '%s'", className);
return JNI_FALSE;;
}
jobject obj = env->NewObject(clazz, constr);
customClassPtr = env->NewGlobalRef(obj);
// if (env->RegisterNatives(clazz, gMethods, numMethods) < 0)
// {
// __android_log_print(ANDROID_LOG_FATAL,"Qt", "Custom RegisterNatives failed for '%s'", className);
// return JNI_FALSE;
// }
return JNI_TRUE;
}
static int registerNativesCustom(JNIEnv* env)
{
if (!registerNativeMethodsCustom(env, customClass, methods, sizeof(methods) / sizeof(methods[0])))
return JNI_FALSE;
return JNI_TRUE;
}
Add next lines to Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* /*reserved*/)
if (!registerNativesCustom(m_env))
{
__android_log_print(ANDROID_LOG_FATAL, "Qt", "Custom registerNatives failed");
return -1;
}
Prepare and call your java class from your file
Prepare your C++ class adding next lines
extern JavaVM *m_javaVM;
extern jobject objptr;
extern jobject customClassPtr;
Now, in your method call the Java method:
JNIEnv* env;
if (m_javaVM->AttachCurrentThread(&env, NULL)<0)
{
qCritical()< <"AttachCurrentThread failed";
return;
}
jclass applicationClass = env->GetObjectClass(customClassPtr);
if (applicationClass) {
jmethodID playMediaFileMethodID = env->GetMethodID(applicationClass,"playMediaFile", "(Ljava/lang/String;)V");
jstring path = env->NewStringUTF("my song");
env->CallStaticVoidMethod(applicationClass, playMediaFileMethodID, path);
}
m_javaVM->DetachCurrentThread();
WARNING
1. The qtmain_android.cpp cand be changed by any Necessitas updates
2. You must change the qtmain_android.coo in both armabi and armabi-v7a
3. Any suggestions and/or questions are welcome.