task
This commit is contained in:
parent
030d19744b
commit
4176fb2139
@ -1,7 +1,6 @@
|
|||||||
package com.example.foodinder_app;
|
package com.example.foodinder_app;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.SystemClock;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
@ -13,6 +12,7 @@ import com.android.volley.RequestQueue;
|
|||||||
import com.android.volley.Response;
|
import com.android.volley.Response;
|
||||||
import com.android.volley.VolleyError;
|
import com.android.volley.VolleyError;
|
||||||
import com.android.volley.toolbox.JsonObjectRequest;
|
import com.android.volley.toolbox.JsonObjectRequest;
|
||||||
|
import com.android.volley.toolbox.StringRequest;
|
||||||
import com.android.volley.toolbox.Volley;
|
import com.android.volley.toolbox.Volley;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
@ -78,6 +78,8 @@ public class Main3Activity extends AppCompatActivity {
|
|||||||
text.setText(card.getName());
|
text.setText(card.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
restart();
|
||||||
|
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
@ -164,4 +166,22 @@ public class Main3Activity extends AppCompatActivity {
|
|||||||
int index = random.nextInt(list.size());
|
int index = random.nextInt(list.size());
|
||||||
return list.get(index);
|
return list.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void restart(){
|
||||||
|
String url = Swipper.api + "/exec?action=restart";
|
||||||
|
|
||||||
|
StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
|
||||||
|
new Response.Listener<String>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(String response) {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Response.ErrorListener() {
|
||||||
|
@Override
|
||||||
|
public void onErrorResponse(VolleyError error) {
|
||||||
|
Toast.makeText(getApplicationContext(), error.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mQueue.add(stringRequest);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user