Not getting value from server into my Textview using android

后端 未结 1 380
面向向阳花
面向向阳花 2021-01-25 06:36

I am new to android , here if i choose forgot password link it should go to next activity and there if i write correct email then it should setText the correct password from ser

相关标签:
1条回答
  • 2021-01-25 06:59

    i got the answer...my php code is fine which i posted above the problem is with json object and json array as @Pier Giorgio Misley told me .so here is my updates activity:

     StringRequest stringRequest = new StringRequest(Request.Method.POST, url_create_book,
                            new Response.Listener<String>() {
                                @Override
                                public void onResponse(String response) {
                                    pDialog.dismiss();
    
                                    try {
                                        JSONObject object     = new JSONObject(response);
    
                                     //   JSONArray jsonArray   = object.getJSONArray(0);
                                      //  JSONObject jsonObject = jsonArray.getJSONObject(0);
    
    // fetch password from JSON
                                        String password         = object.getString("password");
    // use password in textviewfemail.setText(password, TextView.BufferType.EDITABLE);
                                        pas.setText(password, TextView.BufferType.EDITABLE);
    
    
    
                                    }
                                    catch (JSONException e) {
                                        Toast.makeText(ForgotPasswordActivity.this, e.toString(), Toast.LENGTH_LONG).show();
                                    }
    
    0 讨论(0)
提交回复
热议问题