Advertisement
cendolinside

Akun_Get

Nov 12th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.03 KB | None | 0 0
  1. package com.test.api.api.Controller;
  2.  
  3. import android.util.Log;
  4.  
  5. import com.test.api.api.GetSet.tblAkunDatabase;
  6. import com.test.api.api.GetSet.tblAkunDatabase_GET;
  7. import com.test.api.api.Helper.APIInterface2;
  8.  
  9. import java.util.List;
  10.  
  11. import retrofit2.Call;
  12. import retrofit2.Callback;
  13. import retrofit2.Response;
  14.  
  15. /**
  16.  * Created by Jan Sebastian on 11/11/2017.
  17.  */
  18. public class Akun_Get {
  19.     APIInterface2 API2;
  20.     public boolean ket;
  21.     //public List<tblAkunDatabase> nulll;
  22.  
  23.     public Akun_Get()
  24.     {
  25.  
  26.     }
  27.  
  28.     public interface dataCallBack{
  29.         //void onRes(boolean ket);
  30.         void getData(List<tblAkunDatabase> value);
  31.  
  32.         //void onError();
  33.     }
  34.     public void getAkunUserKategori(String user,String kategori,final dataCallBack callBack)
  35.     {
  36.         API2 = Client.getClient().create(APIInterface2.class);
  37.         Call<tblAkunDatabase_GET> listAkun_bytipe_kdUser = API2.listAkun_bytipe_kdUser(kategori,user);
  38.         listAkun_bytipe_kdUser.enqueue(new Callback<tblAkunDatabase_GET>() {
  39.             @Override
  40.             public void onResponse(Call<tblAkunDatabase_GET> call, Response<tblAkunDatabase_GET> response) {
  41.                 if (response.isSuccessful())
  42.                 {
  43.                     if(response.code() == 200)
  44.                     {
  45.                         //List<tblAkunDatabase> data = response.body().getListtblAkun();
  46.                         Log.e("hasiil", String.valueOf(response.body().getListtblAkun()));
  47.                         //callBack.getData(data);
  48.                         if(!response.body().getListtblAkun().isEmpty())
  49.                         {
  50.                             callBack.getData(response.body().getListtblAkun());
  51.                         }
  52.  
  53.                     }
  54.  
  55.                 }
  56.                 else
  57.                 {
  58.  
  59.                 }
  60.             }
  61.  
  62.             @Override
  63.             public void onFailure(Call<tblAkunDatabase_GET> call, Throwable t) {
  64.  
  65.                 Log.e("hasiil", "kosong");
  66.  
  67.             }
  68.         });
  69.     }
  70.  
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement