0

So, I'm having the JSONException (API query), but only when I run the app on an emulator (on different virtual devices, different APIs). The problem exists only with one query. When I call for the same data in another place of the app, it works. On physical device, it works perfectly fine. The question is what can be the cause of this error on an emulator and if I should bother?

Android Studio: 2.2.3

Error:

E/EGL_emulation: tid 2936: eglSurfaceAttrib(1165): error 0x3009 (EGL_BAD_MATCH) E/QueryUtils: Problem parsing the city JSON results org.json.JSONException: No value for data at org.json.JSONObject.get(JSONObject.java:389) at org.json.JSONObject.getJSONObject(JSONObject.java:609) at com.mobileallin.polskiesmogi.QueryUtils.extractFeatureFromJson(QueryUtils.java:171) at com.mobileallin.polskiesmogi.QueryUtils.fetchcityData(QueryUtils.java:58) at com.mobileallin.polskiesmogi.CityLoader.loadInBackground(CityLoader.java:54) at com.mobileallin.polskiesmogi.CityLoader.loadInBackground(CityLoader.java:16) at android.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:312) at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:69) at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:66) at android.os.AsyncTask$2.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818)

Dave
  • 9
  • 3

1 Answers1

0

Ok, so the cause of the problem was very stupid - I was submitting the query on the emulator by hitting enter on the keyboard (search functionality). It seems that hitting enter doesn't trigger the onQueryTextSubmit method the right way on an emulator. You need to click the submit button on the emulator.

Dave
  • 9
  • 3