So I came over this tutorial right here https://www.youtube.com/watch?v=mdAXqQoADt8 (last part of it) everything is working absolutly fine when I'm refering to my local server.
Now I switched it up to an online server/database to test if it works the same way. Also here everything is working fine except of the json response in the onPostExecute Method. I'm getting no messages from registration or login anymore. I really can't figure out how to solve this problem and I don't understand why it doesn't work the same way when I switch it up to an online server/database.
Hope anyone here can help me with that. I'll post some code below, maybe somebody can figure it out without doing the whole tutorial.
Thankful for any help!
@Override
protected void onPostExecute(String json) {
try {
Log.d("JSON-String",json+"");
progressDialog.dismiss();
JSONObject jsonObject = new JSONObject(json);
JSONArray jsonArray = jsonObject.getJSONArray("server_response");
JSONObject JO = jsonArray.getJSONObject(0);
String code = JO.getString("code");
String message = JO.getString("message");
if (code.equals("reg_true"))
{
showDialog("Registrierung erfolgt.", message, code);
}
else if (code.equals("reg_false"))
{
showDialog("Registrierung fehlgeschlagen", message, code);
}
else if(code.equals("login_true"))
{
Intent intent = new Intent(activity, Talkscreen.class); //SPÄTER WIEDER RAUSNEHMEN
activity.startActivity(intent);
activity.finish();
}
else if (code.equals("login_false"))
{
showDialog("Login fehlgeschlagen", message,code);
}
} catch (JSONException e) {
e.printStackTrace();
}
}