I am trying to process a JSON-format string in Android. Does not work. To troubleshoot I use toasts. Now I have two toasts, but only one is showing. Android Studio (newest version) does not show me any issues. Build works fine.
See the code:
if (shpref_url == "no URL defined")
{
Toast toast2 = Toast.makeText(getApplicationContext(), getString(R.string.txturljson), Toast.LENGTH_LONG);
toast2.show();
try {
JSONArray txturljson = new JSONArray(getString(R.string.txturljson));
Toast toast = Toast.makeText(getApplicationContext(), getString(R.string.txturljson), Toast.LENGTH_LONG);
toast.show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
So my question: Why does it show only one toast?
Thanks, Joachim