View difference between Paste ID: aATXzZFZ and RC2jb6iy
SHOW: | | - or go back to the newest paste.
1-
    final ArrayList<String> pic = new ArrayList<String>();
1+
final ArrayList<String> name = new ArrayList<String>();
2-
    final ArrayList<String> name = new ArrayList<String>();
2+
3
    protected void onCreate(Bundle savedInstanceState) {
4
        super.onCreate(savedInstanceState);
5
        setContentView(R.layout.activity_main);
6
        String url="http://192.168.11.6/android_connect/query.php";
7
        txt=(TextView)findViewById(R.id.textView);
8
        RequestQueue mQueue = Volley.newRequestQueue(this);
9-
        txt1=(TextView)findViewById(R.id.textView2);
9+
10
                new Response.Listener<JSONArray>() {
11
                    @Override
12
                    public void onResponse(JSONArray response) {
13
                        for (int i = 0; i < response.length(); i++)
14
                        {
15
                            try {
16
                            JSONObject jobj= response.getJSONObject(i);
17
                            name.add(jobj.getString("name"));
18
                            Log.v("PROGRAM_TAG", ""+name.add(jobj.getString("name")));
19
                            }
20-
                            pic.add(jobj.getString("pic"));
20+
21-
                            Log.v("PROGRAM_TAG", "jobj=" + response.getJSONObject(i));
21+
22
                        Log.d("TAG",String.valueOf(name.isEmpty()));
23
                        txt1.setText(name.toString());
24
                    }
25
                }, new Response.ErrorListener() {
26
            @Override
27
            public void onErrorResponse(VolleyError error) {
28
                Log.d("TAG", "Error: " + error.getMessage());
29
            }
30
        });
31
        txt.setText(String.valueOf(name.isEmpty()));
32
        mQueue.add(req);
33
34
35-
        mQueue.add(req);
35+
36
09-09 13:24:29.626    6673-6673/com.example.jay.volleytest V/PROGRAM_TAG﹕ true
37
09-09 13:24:29.626    6673-6673/com.example.jay.volleytest V/PROGRAM_TAG﹕ true
38
09-09 13:24:29.626    6673-6673/com.example.jay.volleytest V/PROGRAM_TAG﹕ true
39
09-09 13:24:29.626    6673-6673/com.example.jay.volleytest V/PROGRAM_TAG﹕ true
40
09-09 13:24:29.626    6673-6673/com.example.jay.volleytest V/PROGRAM_TAG﹕ true
41
09-09 13:24:29.626    6673-6673/com.example.jay.volleytest D/TAG﹕ false