Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Simeon Markind
/
harrishack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Merge Requests
0
Pipelines
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
152a9578
authored
Jan 11, 2020
by
Simeon Markind
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test pull is working
parent
0eddecc7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletions
DynamicDuals2/app/src/main/java/com/example/dynamicduals2/MainActivity.java
DynamicDuals2/app/src/main/java/com/example/dynamicduals2/MainActivity.java
View file @
152a9578
...
...
@@ -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
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment