Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.test.api.api.Controller;
- import android.util.Log;
- import com.test.api.api.GetSet.tblAkunDatabase;
- import com.test.api.api.GetSet.tblAkunDatabase_GET;
- import com.test.api.api.Helper.APIInterface2;
- import java.util.List;
- import retrofit2.Call;
- import retrofit2.Callback;
- import retrofit2.Response;
- /**
- * Created by Jan Sebastian on 11/11/2017.
- */
- public class Akun_Get {
- APIInterface2 API2;
- public boolean ket;
- //public List<tblAkunDatabase> nulll;
- public Akun_Get()
- {
- }
- public interface dataCallBack{
- //void onRes(boolean ket);
- void getData(List<tblAkunDatabase> value);
- //void onError();
- }
- public void getAkunUserKategori(String user,String kategori,final dataCallBack callBack)
- {
- API2 = Client.getClient().create(APIInterface2.class);
- Call<tblAkunDatabase_GET> listAkun_bytipe_kdUser = API2.listAkun_bytipe_kdUser(kategori,user);
- listAkun_bytipe_kdUser.enqueue(new Callback<tblAkunDatabase_GET>() {
- @Override
- public void onResponse(Call<tblAkunDatabase_GET> call, Response<tblAkunDatabase_GET> response) {
- if (response.isSuccessful())
- {
- if(response.code() == 200)
- {
- //List<tblAkunDatabase> data = response.body().getListtblAkun();
- Log.e("hasiil", String.valueOf(response.body().getListtblAkun()));
- //callBack.getData(data);
- if(!response.body().getListtblAkun().isEmpty())
- {
- callBack.getData(response.body().getListtblAkun());
- }
- }
- }
- else
- {
- }
- }
- @Override
- public void onFailure(Call<tblAkunDatabase_GET> call, Throwable t) {
- Log.e("hasiil", "kosong");
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement