Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Activity doesn't start
    primarykey
    data
    text
    <p>I am parsing json data from php script. If I write the correct values in EditText fields the activity will start. But after writing incorect one activity won't start up. How to fix it?</p> <p>I will show only the part about work with layout items because parsing goes well. Also what king of aproach would be best to test login values? Username is easy to check because it is returned by JSON but what about password. I think it would be wrong choice to put it in the JSON.</p> <pre><code>try{ JSONArray jArray = new JSONArray(result); for(int i=0;i&lt;jArray.length();i++){ JSONObject json_data = jArray.getJSONObject(i); usernameFromDB = json_data.getString("username"); firstnameFromDB = json_data.getString("firstname"); lastnameFromDB = json_data.getString("lastname"); emailFromDB = json_data.getString("email"); phoneFromDB = json_data.getString("phone1"); skypeFromDB = json_data.getString("skype"); cityFromDB = json_data.getString("city"); descriptionFromDB = json_data.getString("description"); System.out.println(usernameFromDB+ " " + firstnameFromDB+" "+lastnameFromDB+" " + emailFromDB + " " + phoneFromDB +" " + skypeFromDB+ " " + cityFromDB + " "+ descriptionFromDB); } } catch(JSONException e){ AlertDialog alertDialog = new AlertDialog.Builder(MyMoodleApplicationActivity.this).create(); alertDialog.setTitle("Klaida!"); alertDialog.setMessage("Toks vartotojas neegzistuoja"); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub return; } }); alertDialog.show(); Log.e("log_tag", "Error parsing data "+e.toString()); } if(usr.length()== 0){ AlertDialog alertDialog = new AlertDialog.Builder(MyMoodleApplicationActivity.this).create(); alertDialog.setTitle("Klaida!"); alertDialog.setMessage("Jus neivedete slapyvardžio"); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub return; } }); alertDialog.show(); } else if(psw.length()==0){ AlertDialog alertDialog = new AlertDialog.Builder(MyMoodleApplicationActivity.this).create(); alertDialog.setTitle("Klaida!"); alertDialog.setMessage("Jus neivedete slaptažodžio"); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub return; } }); alertDialog.show(); } else if(usernameFromDB.equals(usr)){ Intent in = new Intent(getApplicationContext(), LoggedUser.class); in.putExtra("firstname", firstnameFromDB); in.putExtra("lastname", lastnameFromDB); in.putExtra("email", emailFromDB); in.putExtra("phone1", phoneFromDB); in.putExtra("skype", skypeFromDB); in.putExtra("city", cityFromDB); in.putExtra("description", descriptionFromDB); startActivity(in); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload