android - Error but I do not know exactly why -


i want know technology of battery in android . have finished , done javacode broadcastreceiver . when use java class battery in qt , intent not run java code . decide make run in qt .

qandroidjniobject activity =  qandroidjniobject::callstaticobjectmethod("org/qtproject/qt5/android/qtnative", "activity", "()landroid/app/activity;"); if (activity.isvalid()) {          qandroidjniobject callconstant = qandroidjniobject::getstaticobjectfield<jstring>("android/content/intent", "action_battery_changed");         qandroidjniobject callintent("android/content/intent",  "(ljava/lang/string;)v", callconstant.object());          qandroidjniobject param = qandroidjniobject::fromstring("technology" ) ;           mysubstring = callintent.callobjectmethod("getstringextra"                                     ,"(ljava/lang/string;)ljava/lang/string;"                                     ,param.object()) ;            if(callintent.isvalid())         {              activity.callobjectmethod("startactivity", "(landroid/content/intent;)v", callintent.object<jobject>());             //activity.callmethod<void>("startactivity","(landroid/content/intent;)v", callintent.object<jobject>());          } 

}

both lines make program halt badly . still not find out

             activity.callobjectmethod("startactivity", "(landroid/content/intent;)v", callintent.object<jobject>());             //activity.callmethod<void>("startactivity","(landroid/content/intent;)v", callintent.object<jobject>()); 

good weekend pro ! .

i find out way solve use qtandroid::androidactivity().callmethod in main , change myactivity extends qtactivity instead of activity or else in android . simple , way can battery information . bright way solve . why previous code activity.callobjectmethod("startactivity", "(landroid/content/intent;)v", callintent.object()); make program crashed severely still not find out . thank .


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -