Ver Fonte

Fixed issue that was causing GET to bug out. I had accidentally swapped the if/else conditions.

Thomas Flucke há 9 anos atrás
pai
commit
6546178ba8

+ 1 - 1
app/src/main/java/com/example/yiupang/freefoodfinder/CreateEventScreen.java

@@ -78,7 +78,7 @@ public class CreateEventScreen extends Fragment{
                 httpr.setUrl("https://free-food-finder.herokuapp.com/events");
                 new HttpRequest(){
                     @Override
-                    public void onResponse(List<Event> response)
+                    public void onResponse(Object response, int code)
                     {
                         Intent details = new Intent(getContext(), EventsScreen.class);
                         startActivity(details);

+ 1 - 1
app/src/main/java/com/example/yiupang/freefoodfinder/CreateEventScreen1.java

@@ -55,7 +55,7 @@ public class CreateEventScreen1 extends AppCompatActivity {
                 httpr.setUrl("https://free-food-finder.herokuapp.com/events");
                 new HttpRequest(){
                     @Override
-                    public void onResponse(List<Event> response)
+                    public void onResponse(Object response, int code)
                     {
                         finishActivity(0);
                     }

+ 1 - 1
app/src/main/java/com/example/yiupang/freefoodfinder/HttpRequest.java

@@ -62,7 +62,7 @@ class HttpRequest extends AsyncTask<HttpCall, String, String>
 
             /*Handle the response*/
             responseCode = urlConnection.getResponseCode();
-            if (responseCode >= 300)
+            if (responseCode < 300)
             {
                 ObjectMapper mapper = new ObjectMapper();
                 response = mapper.readTree(urlConnection.getInputStream());