public class ProcessManager extends Cocos2dxActivity { private static String TAG = "AM_MEMORYIPROCESS"; private ActivityManager mActivityManager = null; public static ProcessManager actInstance = null ;/ / define a single case public static Object getInstance () { if (actInstance == null) { actInstance = new ProcessManager (); } Log.d ("daa", "fsfsdf"); return actInstance; } protected void onCreate (Bundle savedInstanceState) { super.onCreate (savedInstanceState); } public void getProcess () { Log.d ("cocosAct", "go on!!!"); } } After the execution, which can be seen in LogCat under xcode play log, but the implementation of the minfo.env-> CallVoidMethod (jobj, minfo.methodID), and then collapse. getProcess () in the log does not print out, this method is called non-static function find online, so we are writing, I do not know what went wrong, ask for help to solve the heroes.
<-! Baidu Button BEGIN -> more Share to: <-! Baidu Button END ->
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) -> Reply: If you are calling in another thread, please check if there is (g_jvmInstance) -> AttachCurrentThread (& env, NULL); Reply:
In the beginning I did not let ProcessManager class inherits Activity class, so call a non-static functions can not be wrong, but after inheriting Activity on the wrong class. Reply:
No wonder ah, Activity is running on the UI thread, how can you call it a member of the method in other places too? Activity itself can only be invoked Reply:
If you are calling in another thread, please check if there is (g_jvmInstance) -> AttachCurrentThread (& env, NULL);
In the beginning I did not let ProcessManager class inherits Activity class, so call a non-static functions can not be wrong, but later on the Activity class inherits wrong.
No wonder ah, Activity is running on the UI thread, how can you call it a member of the method in other places too? Activity itself can only be invoked
When I wrote the above return actInstance object, ah! Not directly call the member function inside ProcessManager. You look at the code I posted above should be how to change it? android I really do not understand, but now there is a project where things need to use Android, and then want to measure what is called, is stuck.
No comments:
Post a Comment