本文整理汇总了C++中GetMethodID函数的典型用法代码示例。如果您正苦于以下问题:C++ GetMethodID函数的具体用法?C++ GetMethodID怎么用?C++ GetMethodID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetMethodID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CS_ASSERT
//---------------------------------------------------------------
//---------------------------------------------------------------
void GooglePlayIAPJavaInterface::StartListeningForTransactionUpdates(const CSNetworking::IAPSystem::TransactionStatusDelegate& in_delegate)
{
CS_ASSERT(in_delegate != nullptr, "Cannot have null transaction delegate");
m_transactionStatusDelegate = in_delegate;
JNIEnv* env = JavaInterfaceManager::GetSingletonPtr()->GetJNIEnvironmentPtr();
env->CallVoidMethod(GetJavaObject(), GetMethodID("RestorePendingUnmanagedTransactions"));
Json::Value jData;
if(CSCore::JsonUtils::ReadJson(CSCore::StorageLocation::k_cache, k_pendingCacheFile, jData))
{
const Json::Value::Members& members = jData.getMemberNames();
jobjectArray transactionIDs = env->NewObjectArray(members.size(), env->FindClass("java/lang/String"), env->NewStringUTF(""));
u32 index = 0;
for(Json::Value::Members::const_iterator it = members.begin(); it != members.end(); ++it, ++index)
{
jstring jtransactionId = JavaInterfaceUtils::CreateJStringFromSTDString(*it);
env->SetObjectArrayElement(transactionIDs, index, jtransactionId);
env->DeleteLocalRef(jtransactionId);
}
env->CallVoidMethod(GetJavaObject(), GetMethodID("RestorePendingManagedTransactions"), transactionIDs);
env->DeleteLocalRef(transactionIDs);
}
}
示例2: JOP_ASSERT
ActivityState* ActivityState::create(ANativeActivity* activity)
{
JOP_ASSERT(ns_instance == nullptr, "There must only be one ActivityState!");
ns_instance.reset(new ActivityState);
ns_instance->nativeActivity = activity;
ANativeActivity_setWindowFlags(activity, AWINDOW_FLAG_KEEP_SCREEN_ON, AWINDOW_FLAG_KEEP_SCREEN_ON);
Thread::attachJavaThread(activity->vm, activity->env);
// Get the screen size
{
auto env = Thread::getCurrentJavaEnv();
if (!env)
{
JOP_DEBUG_ERROR("No current java environment, function \"" << __func__ << "\"");
return get();
}
jclass activityClass = env->GetObjectClass(activity->clazz);
jclass displayMetricsClass = env->FindClass("android/util/DisplayMetrics");
jmethodID displayMetricsInit = env->GetMethodID(displayMetricsClass, "<init>", "()V");
jobject displayMetricsObject = env->NewObject(displayMetricsClass, displayMetricsInit);
jmethodID getWindowManagerMethod = env->GetMethodID(activityClass, "getWindowManager", "()Landroid/view/WindowManager;");
jobject windowManagerObject = env->CallObjectMethod(activity->clazz, getWindowManagerMethod);
jclass windowManagerClass = env->FindClass("android/view/WindowManager");
jmethodID getDefaultDisplayMethod = env->GetMethodID(windowManagerClass, "getDefaultDisplay", "()Landroid/view/Display;");
jobject displayObject = env->CallObjectMethod(windowManagerObject, getDefaultDisplayMethod);
jclass displayClass = env->FindClass("android/view/Display");
jmethodID getMetricsMethod = env->GetMethodID(displayClass, "getMetrics", "(Landroid/util/DisplayMetrics;)V");
env->CallVoidMethod(displayObject, getMetricsMethod, displayMetricsObject);
jfieldID pixelsWidth = env->GetFieldID(displayMetricsClass, "widthPixels", "I");
jfieldID pixelsHeight = env->GetFieldID(displayMetricsClass, "heightPixels", "I");
ns_instance->screenSize.x = env->GetIntField(displayMetricsObject, pixelsWidth);
ns_instance->screenSize.y = env->GetIntField(displayMetricsObject, pixelsHeight);
//jmethodID getRefreshRateMethod = env->GetMethodID(displayClass, "getRefreshRate", "(Landroid/view/Display;)F");
ns_instance->screenRefreshRate = 60;//env->CallFloatMethod(displayObject, getRefreshRateMethod);
env->DeleteLocalRef(activityClass);
env->DeleteLocalRef(displayMetricsObject);
env->DeleteLocalRef(windowManagerObject);
env->DeleteLocalRef(windowManagerClass);
env->DeleteLocalRef(displayObject);
env->DeleteLocalRef(displayClass);
}
return get();
}
示例3: forceScreenClear
template <class R> GVRActivityT<R>::GVRActivityT(JNIEnv & jni_, jobject activityObject_)
: forceScreenClear( false )
, ModelLoaded( false )
, UiJni(&jni_)
, viewManager(NULL)
{
viewManager = new GVRViewManager(jni_,activityObject_);
javaObject = UiJni->NewGlobalRef( activityObject_ );
activityClass = GetGlobalClassReference( activityClassName );
vrAppSettingsClass = GetGlobalClassReference(app_settings_name);
oneTimeInitMethodId = GetMethodID("oneTimeInit", "()V");
oneTimeShutdownMethodId = GetMethodID("oneTimeShutDown", "()V");
drawFrameMethodId = GetMethodID("drawFrame", "()V");
beforeDrawEyesMethodId = GetMethodID("beforeDrawEyes", "()V");
drawEyeViewMethodId = GetMethodID("onDrawEyeView", "(IF)V");
afterDrawEyesMethodId = GetMethodID("afterDrawEyes", "()V");
onKeyEventNativeMethodId = GetMethodID("onKeyEventNative", "(II)Z");
updateSensoredSceneMethodId = GetMethodID("updateSensoredScene", "()Z");
getAppSettingsMethodId = GetMethodID("getAppSettings",
"()Lorg/gearvrf/utility/VrAppSettings;");
}
示例4: JNI_OnLoad
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *pjvm, void *reserved) {
ILOG("JNI_OnLoad");
gJvm = pjvm; // cache the JavaVM pointer
auto env = getEnv();
//replace with one of your classes in the line below
auto randomClass = env->FindClass("org/ppsspp/ppsspp/NativeActivity");
jclass classClass = env->GetObjectClass(randomClass);
auto classLoaderClass = env->FindClass("java/lang/ClassLoader");
auto getClassLoaderMethod = env->GetMethodID(classClass, "getClassLoader",
"()Ljava/lang/ClassLoader;");
gClassLoader = env->NewGlobalRef(env->CallObjectMethod(randomClass, getClassLoaderMethod));
gFindClassMethod = env->GetMethodID(classLoaderClass, "findClass",
"(Ljava/lang/String;)Ljava/lang/Class;");
return JNI_VERSION_1_6;
}
示例5: bitmap_dispose
static void bitmap_dispose(Class *cl, Object *obj, Msg *msg)
{
struct HIDDBitMapAmigaIntuiData *data = INST_DATA(cl, obj);
struct pHidd_BitMap_PrivateSet private_set_msg;
EnterFunc(bug("BitMapAmigaIntui::Dispose()\n"));
if(data->screen)
{
/*
We use an own buffer so set the BaseAddress to NULL to prevent
the superclass to free our own buffer.
*/
struct TagItem set[] =
{
{aHidd_BitMap_BaseAddress, NULL},
{TAG_END , 0 }
};
CloseScreen(data->screen);
private_set_msg.mID = GetMethodID(IID_Hidd_BitMap, moHidd_BitMap_PrivateSet);
private_set_msg.attrList = set;
DoSuperMethod(cl, obj, (Msg) &private_set_msg);
}
DoSuperMethod(cl, obj, (Msg) msg);
ReturnVoid("BitMapAmigaIntui::Dispose");
}
示例6: addr
bool NetCenter::ConnectServiceWhitFD(int fd , const char* host_name, int port)
{
if (!_run_flg)
{
return false;
}
SocketAddress addr(host_name, port);
CriticalSectionScoped css(&cs_);
std::map<SOCKET, struct stSocketObj*>::iterator it = socket_objs.find(fd);
if (socket_objs.end() == it)
{
return false;
}
if (it->second->dispatch->Connect(addr) != 0)
{
return false;
}
if (it->second->dispatch->GetState() == jsbn::AsyncSocket::CS_CONNECTED)
{
jmethodID m = GetMethodID(jni(), *j_observer_class_, "StatusReportWithFD", "(II)V");
jni()->CallVoidMethod(*j_observer_global_, m, it->second->dispatch->GetDescriptor(), (int)ENE_CONNECTED);
}
return true;
}
示例7: GetMethodID
//-------------------------------------------------------
//-------------------------------------------------------
void TextEntryJavaInterface::SetTextBuffer(const std::string& in_text)
{
JNIEnv* env = JavaInterfaceManager::GetSingletonPtr()->GetJNIEnvironmentPtr();
jstring text = JavaInterfaceUtils::CreateJStringFromSTDString(in_text);
env->CallVoidMethod(GetJavaObject(), GetMethodID("setTextBuffer"), text);
env->DeleteLocalRef(text);
}
示例8: GetMethodID
//--------------------------------------------------------------
/// Present
//--------------------------------------------------------------
void EmailComposerJavaInterface::Present(const std::vector<std::string>& inastrRecipientAddresses, const std::string& instrSubject, const std::string& instrContents,
bool inbFormatAsHtml, const std::string& instrAttachmentFilename, const ResultDelegate& inDelegate)
{
mDelegate = inDelegate;
JNIEnv* pEnv = JavaInterfaceManager::GetSingletonPtr()->GetJNIEnvironmentPtr();
//build the recipient list
u32 udwCount = 0;
jobjectArray ajstrRecipients = pEnv->NewObjectArray(inastrRecipientAddresses.size(), pEnv->FindClass("java/lang/String"), pEnv->NewStringUTF(""));
for(auto it = inastrRecipientAddresses.begin(); it != inastrRecipientAddresses.end(); ++it)
{
jstring jstrRecipient = JavaUtils::CreateJStringFromSTDString(*it);
pEnv->SetObjectArrayElement(ajstrRecipients,udwCount++, jstrRecipient);
pEnv->DeleteLocalRef(jstrRecipient);
}
jstring jstrSubject = JavaUtils::CreateJStringFromSTDString(instrSubject);
jstring jstrContents = JavaUtils::CreateJStringFromSTDString(instrContents);
jstring jstrAttachmentFilename = JavaUtils::CreateJStringFromSTDString(instrAttachmentFilename);
//call method
pEnv->CallVoidMethod(GetJavaObject(), GetMethodID("Present"), ajstrRecipients, jstrSubject, jstrContents, inbFormatAsHtml, jstrAttachmentFilename);
//clean up
pEnv->DeleteLocalRef(ajstrRecipients);
pEnv->DeleteLocalRef(jstrSubject);
pEnv->DeleteLocalRef(jstrContents);
pEnv->DeleteLocalRef(jstrAttachmentFilename);
}
示例9: GetMethodID
//---------------------------------------------------------------
//---------------------------------------------------------------
void AmazonIAPJavaInterface::StopListeningForTransactionUpdates()
{
m_transactionStatusDelegate = nullptr;
JNIEnv* env = JavaInterfaceManager::GetSingletonPtr()->GetJNIEnvironmentPtr();
env->CallVoidMethod(GetJavaObject(), GetMethodID("StopListeningForTransactionUpdates"));
}
示例10: CS_ASSERT
//---------------------------------------------------------------
//---------------------------------------------------------------
void AmazonIAPJavaInterface::RequestProductDescriptions(const std::vector<std::string>& in_productIds, const CSNetworking::IAPSystem::ProductDescDelegate& in_delegate)
{
CS_ASSERT(in_productIds.empty() == false, "Cannot request no product descriptions");
CS_ASSERT(in_delegate != nullptr, "Cannot have null product description delegate");
CS_ASSERT(m_productsRequestDelegate == nullptr, "Only 1 product description request can be active at a time");
m_productsRequestDelegate = in_delegate;
JNIEnv* env = JavaInterfaceManager::GetSingletonPtr()->GetJNIEnvironmentPtr();
jstring jstrEmptyString = env->NewStringUTF("");
jclass jStringClass = env->FindClass("java/lang/String");
jobjectArray productIDs = env->NewObjectArray(in_productIds.size(), jStringClass, jstrEmptyString);
u32 productIDIndex = 0;
for(std::vector<std::string>::const_iterator it = in_productIds.begin(); it != in_productIds.end(); ++it)
{
jstring productID = JavaUtils::CreateJStringFromSTDString(*it);
env->SetObjectArrayElement(productIDs, productIDIndex, productID);
env->DeleteLocalRef(productID);
productIDIndex++;
}
env->CallVoidMethod(GetJavaObject(), GetMethodID("RequestProductDescriptions"), productIDs);
env->DeleteLocalRef(productIDs);
env->DeleteLocalRef(jstrEmptyString);
env->DeleteLocalRef(jStringClass);
}
示例11: GetMethodID
//-----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------
TimeIntervalMs CoreJavaInterface::GetSystemTimeInMilliseconds()
{
TimeIntervalMs output = 0;
JNIEnv* env = JavaInterfaceManager::GetSingletonPtr()->GetJNIEnvironmentPtr();
output = (TimeIntervalMs)env->CallLongMethod(GetJavaObject(), GetMethodID("getSystemTimeInMilliseconds"));
return output;
}
示例12: GetMethodID
//------------------------------------------------------
//------------------------------------------------------
void DialogueBoxJavaInterface::MakeToast(const std::string& in_text)
{
JNIEnv* env = JavaInterfaceManager::GetSingletonPtr()->GetJNIEnvironmentPtr();
jstring message = JavaInterfaceUtils::CreateJStringFromSTDString(in_text);
env->CallVoidMethod(GetJavaObject(), GetMethodID("makeToast"), message);
env->DeleteLocalRef(message);
}
示例13: invokeStaticMethod
jobject invokeStaticMethod(JNIEnv* env, const char* class_name,
const char* method_name, const char* sig, jclass pareValues[])
{
jclass obj_class = FindClass(env, class_name);
jmethodID methodId = GetMethodID(obj_class, method_name, sig);
}
示例14: GetMethodID
//------------------------------------------------
/// Stop Listening
//------------------------------------------------
void AccelerometerJavaInterface::StopListening()
{
if (true == mbListening)
{
mAccelerationChangedDelegate = nullptr;
JNIEnv* pEnv = JavaInterfaceManager::GetSingletonPtr()->GetJNIEnvironmentPtr();
pEnv->CallVoidMethod(GetJavaObject(), GetMethodID("StopListening"));
mbListening = false;
}
}
示例15: GetMethodID
void MeganekkoActivity::OneTimeShutdown()
{
delete SoundEffectPlayer;
SoundEffectPlayer = NULL;
delete SoundEffectContext;
SoundEffectContext = NULL;
jmethodID oneTimeShutdownMethodId = GetMethodID("oneTimeShutDown", "()V");
app->GetJava()->Env->CallVoidMethod(app->GetJava()->ActivityObject, oneTimeShutdownMethodId);
}