The application uses the following scheme:
AsyncTaskis created.- The
doInBackground()loading data from the server. - Using
try {} catch(IOException e){}a boot error is caught, if there is one.
The result is this: in the absence of the Internet, the application just crashes with an error ... Question: how to make the application not crash, but display a message about the connection problem?
UPD Code on which the application falls:
try { items = json.getJSONArray("result"); } catch (JSONException e) { e.printStackTrace(); } Logcat:
Process: ru.mediaznak.test, PID: 6410 java.lang.NullPointerException at ru.mediaznak.testvk.MainActivity $ JSONParse.onPostExecute (MainActivity.java:271)
I understand that something is wrong in json
AsyncTaskcode. - Opalosolo