Commit 152a9578 by Simeon Markind

Test pull is working

parent 0eddecc7
......@@ -10,9 +10,11 @@ import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.example.dynamicduals2.jigs.ComplaintTypeCount;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
......@@ -32,12 +34,16 @@ public class MainActivity extends AppCompatActivity {
private TextView mSR_TYPE1;
private TextView mC_1;
private RequestQueue mQueue;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mQueue = Volley.newRequestQueue(this);
gson = new Gson();
mBtnTop3 = findViewById(R.id.btnTop3Complaints);
mWard = findViewById(R.id.ward);
......@@ -74,12 +80,15 @@ public class MainActivity extends AppCompatActivity {
}
private void fetchTop3(String url) {
StringRequest stringRequest = new StringRequest(Request.Method.GET, url, onTop3ListLoaded, onTop3ListError);
mQueue.add(stringRequest);
}
private final Response.Listener<String> onTop3ListLoaded = new Response.Listener<String>() {
@Override
public void onResponse(String response) {
ComplaintTypeCount[] complaintTypeCounts = gson.fromJson(response, ComplaintTypeCount[].class);
ComplaintTypeCount[] complaintTypeCounts =
gson.fromJson(response, ComplaintTypeCount[].class);
mSR_TYPE1.setText(complaintTypeCounts[0].getSrType());
mC_1.setText(complaintTypeCounts[0].getC());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment