Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @OnClick(R.id.next) void next() {
- Log.d("score", "masuk");
- result.get(0).getScore();
- Log.d("Score Activity","score is" + result.get(0).getNama());
- Gson gson = new Gson();
- String json = gson.toJson(result);
- System.out.println(json);
- Log.d("json", json);
- Retrofit retrofit = new Retrofit.Builder()
- .baseUrl(URL)
- .addConverterFactory(GsonConverterFactory.create())
- .build();
- RequestApi api = retrofit.create(RequestApi.class);
- Call<Value> call = api.holecreate(gson.toJson(result));
- Log.d("datas", call.toString());
- call.enqueue(new Callback<Value>() {
- @Override
- public void onResponse(Call<Value> call, Response<Value> response) {
- String value = response.body().getValue();
- String message = response.body().getMessage();
- Log.d("return", message);
- if (value.equals("1")) {
- Toast.makeText(HoleActivity.this, message, Toast.LENGTH_SHORT).show();
- } else {
- Toast.makeText(HoleActivity.this, message, Toast.LENGTH_SHORT).show();
- }
- }
- @Override
- public void onFailure(Call<Value> call, Throwable t) {
- Log.d("return", "error");
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment