Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void getDetail(){
- String dadali ="dadali";
- String metland = "metland";
- btn_proses.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- if (destination.getText().toString() == dadali) {
- ApiInterfaces apiInterface = Api.getUrl().create(ApiInterfaces.class);
- Call<Rute> call = apiInterface.getRute(1);
- call.enqueue(new Callback<Rute>() {
- @Override
- public void onResponse(Call<Rute> call, Response<Rute> response) {
- Rute.Data data = response.body().getData();
- Log.e("_getproduc",data.getWaktu_tercepat());
- TextView rute1 = findViewById(R.id.rute1);
- rute1.setText("WAKTU TERCEPAT :" + data.getWaktu_tercepat());
- TextView jarak2 = findViewById(R.id.rute2);
- jarak2.setText("JARAK 1 :" + data.getJarak1() + " WAKTU =" + data.getWaktu1());
- TextView jarak3 = findViewById(R.id.rute3);
- jarak3.setText("JARAK 2 :" + data.getJarak2() + " WAKTU =" + data.getWaktu2());
- }
- @Override
- public void onFailure(Call<Rute> call, Throwable t) {
- }
- });
- }
- else if(metland == destination.getText().toString()){
- ApiInterfaces apiInterface = Api.getUrl().create(ApiInterfaces.class);
- Call<Rute> call = apiInterface.getRute(2);
- call.enqueue(new Callback<Rute>() {
- @Override
- public void onResponse(Call<Rute> call, Response<Rute> response) {
- Rute.Data data = response.body().getData();
- Log.e("_getproduc",data.getWaktu_tercepat());
- TextView rute1 = findViewById(R.id.rute1);
- rute1.setText("WAKTU TERCEPAT :" + data.getWaktu_tercepat());
- TextView jarak2 = findViewById(R.id.rute2);
- jarak2.setText("JARAK 1 :" + data.getJarak1() + " WAKTU =" + data.getWaktu1());
- TextView jarak3 = findViewById(R.id.rute3);
- jarak3.setText("JARAK 2 :" + data.getJarak2() + " WAKTU =" + data.getWaktu2());
- }
- @Override
- public void onFailure(Call<Rute> call, Throwable t) {
- }
- });
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement