diff --git a/android/app/src/main/java/com/classicube/MainActivity.java b/android/app/src/main/java/com/classicube/MainActivity.java index 6dff6fe48..09316663f 100644 --- a/android/app/src/main/java/com/classicube/MainActivity.java +++ b/android/app/src/main/java/com/classicube/MainActivity.java @@ -63,8 +63,9 @@ public class MainActivity extends Activity { // Therefore pushing/pulling events must be thread-safe, which is achieved through ConcurrentLinkedQueue // Additionally, a cache is used (freeCmds) to avoid constantly allocating NativeCmdArgs instances class NativeCmdArgs { public int cmd, arg1, arg2, arg3, arg4; public String str; public Surface sur; } - Queue pending = new ConcurrentLinkedQueue(); - Queue freeCmds = new ConcurrentLinkedQueue(); + // static to persist across activity destroy/create + static Queue pending = new ConcurrentLinkedQueue(); + static Queue freeCmds = new ConcurrentLinkedQueue(); NativeCmdArgs getCmdArgs() { NativeCmdArgs args = freeCmds.poll(); @@ -136,8 +137,9 @@ public class MainActivity extends Activity { // ====================================== // --------------- EVENTS --------------- // ====================================== - static boolean gameRunning; InputMethodManager input; + // static to persist across activity destroy/create + static boolean gameRunning; void startGameAsync() { Log.i("CC_WIN", "handing off to native.."); diff --git a/src/Http_Worker.c b/src/Http_Worker.c index 8fcf51a03..37228e78f 100644 --- a/src/Http_Worker.c +++ b/src/Http_Worker.c @@ -631,8 +631,8 @@ static cc_result HttpBackend_Do(struct HttpRequest* req, cc_string* url) { *-----------------------------------------------------Android backend-----------------------------------------------------* *#########################################################################################################################*/ struct HttpRequest* java_req; -static JMethodID JAVA_httpInit, JAVA_httpSetHeader, JAVA_httpPerform, JAVA_httpSetData; -static JMethodID JAVA_httpDescribeError; +static jmethodID JAVA_httpInit, JAVA_httpSetHeader, JAVA_httpPerform, JAVA_httpSetData; +static jmethodID JAVA_httpDescribeError; cc_bool Http_DescribeError(cc_result res, cc_string* dst) { char buffer[NATIVE_STR_LEN]; @@ -741,7 +741,7 @@ static cc_result HttpBackend_Do(struct HttpRequest* req, cc_string* url) { req->_capacity = 0; http_curProgress = HTTP_PROGRESS_FETCHING_DATA; - res = JavaInstanceCall_Int(env, JAVA_httpPerform, args); + res = JavaInstanceCall_Int(env, JAVA_httpPerform, NULL); http_curProgress = 100; return res; }