daily pastebin goal
4%
SHARE
TWEET

Untitled

a guest Dec 11th, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.yatimmandiri.erp.zisco.modules.donatur;
  2.  
  3. import android.os.Bundle;
  4. import android.support.annotation.Nullable;
  5. import android.support.v7.app.AppCompatActivity;
  6. import android.support.v7.widget.Toolbar;
  7. import android.view.View;
  8. import android.widget.TextView;
  9.  
  10. import com.yatimmandiri.erp.zisco.R;
  11. import com.yatimmandiri.erp.zisco.api.ApiClient;
  12. import com.yatimmandiri.erp.zisco.api.ApiInterface;
  13. import com.yatimmandiri.erp.zisco.model.Detail_Donatur;
  14. import com.yatimmandiri.erp.zisco.modules.login.LoginActivity;
  15.  
  16. import java.util.HashMap;
  17.  
  18. import retrofit2.Call;
  19. import retrofit2.Callback;
  20. import retrofit2.Response;
  21.  
  22. import static com.yatimmandiri.erp.zisco.modules.login.LoginActivity.token;
  23.  
  24. /**
  25.  * Created by Aji Guna on 28/08/2018.
  26.  */
  27.  
  28. public class DonaturInfoActivity extends AppCompatActivity{
  29.  
  30.     TextView kode,nama,nominal,type,telp,status,jenis,alamat,institusi;
  31.     Call<Detail_Donatur> call;
  32.     private ApiInterface apiInterface;
  33.     String mPost_key;
  34.  
  35.     @Override
  36.     protected void onCreate(@Nullable Bundle savedInstanceState) {
  37.         super.onCreate(savedInstanceState);
  38.         setContentView(R.layout.activity_info_donatur_up);
  39.  
  40.         Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  41.         toolbar.setTitle("Donatur");
  42.         toolbar.setNavigationIcon(R.drawable.ic_arrow_left);
  43.  
  44.         toolbar.setNavigationOnClickListener(new View.OnClickListener() {
  45.             @Override
  46.             public void onClick(View v) {
  47.                 finish();
  48.             }
  49.         });
  50.  
  51.         mPost_key = getIntent().getExtras().getString("id");
  52.         kode = (TextView)findViewById(R.id.kode);
  53.         nama = (TextView)findViewById(R.id.teks_nama);
  54.         nominal = (TextView)findViewById(R.id.nominal);
  55.         type = (TextView)findViewById(R.id.jenis_donatur);
  56.         telp = (TextView)findViewById(R.id.telp);
  57.         status = (TextView)findViewById(R.id.status);
  58.         jenis = (TextView)findViewById(R.id.jenis_donasi);
  59.         alamat = (TextView)findViewById(R.id.alamat);
  60.         institusi = (TextView)findViewById(R.id.institusi);
  61.  
  62.         getData();
  63.     }
  64.  
  65.     private void getData() {
  66.         HashMap<String, String> params = new HashMap<>();
  67.         params.put("token", token);
  68.         apiInterface = ApiClient.getClient().create(ApiInterface.class);
  69.         call = apiInterface.getDetur(mPost_key, LoginActivity.api_key, LoginActivity.secret,params);
  70.  
  71.         call.enqueue(new Callback<Detail_Donatur>() {
  72.             @Override
  73.             public void onResponse(Call<Detail_Donatur> call, Response<Detail_Donatur> response) {
  74. //                String data = response.body().getData();
  75.                 kode.setText("KODE: "+response.body().getData().getCode());
  76.                 nama.setText(response.body().getData().getName());
  77.                 nominal.setText(response.body().getData().getNominal());
  78.                 type.setText(response.body().getData().getType());
  79.                 telp.setText(response.body().getData().getPhone());
  80.                 status.setText(response.body().getData().getStatus());
  81.                 jenis.setText(response.body().getData().getDonorType());
  82.                 alamat.setText(response.body().getData().getAddress());
  83.                 institusi.setText(response.body().getData().getInstitution());
  84.             }
  85.             @Override
  86.             public void onFailure(Call<Detail_Donatur> call, Throwable t) {
  87.                 t.printStackTrace();
  88.             }
  89.         });
  90.     }
  91. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top