See More
Popular Forum

MBA (4887) B.Tech (1769) Engineering (1486) Class 12 (1030) Study Abroad (1004) Computer Science and Engineering (988) Business Management Studies (865) BBA (846) Diploma (746) CAT (651) B.Com (648) B.Sc (643) JEE Mains (618) Mechanical Engineering (574) Exam (525) India (462) Career (452) All Time Q&A (439) Mass Communication (427) BCA (417) Science (384) Computers & IT (Non-Engg) (383) Medicine & Health Sciences (381) Hotel Management (373) Civil Engineering (353) MCA (349) Tuteehub Top Questions (348) Distance (340) Colleges in India (334)
See More

2 Spinners: Populate second spinner from first spinner id selected using Retrofit

General Tech Bugs & Fixes

Max. 2000 characters



( 6 months ago )


Hi I working with my android, I have two spinners and using retrofit to populate my spinners. I manage to populate first spinner. But I don't know how to get my second spinner populated under id selected from first spinner. I'm using codeigniter rest controller to pass the id and want to retrieve it using retrofit for second spinner, but I don't know how to do this? Please help me.

I already created Rest Controller by passing the id. Already created ApiInterface. And beans to get details data. First spinner working good.


 classSpinner = (Spinner) findViewById(;
    divSpinner = (Spinner) findViewById(;


    mApiInterface = ApiClient.getClient().create(ApiInterface.class);



public interface ApiInterface {

//first spinner
    Call<GetProvinsi> getProvinsi();

//second spinner that I needed how to pass the id? and get data by id selected from first spinner
    Call<GetKota> getKota();

GetProvinsi ( First Spinner )

public class GetProvinsi {

List<Provinsi> listDataProvinsi;

public List<Provinsi> getListDataProvinsi() {
    return listDataProvinsi;
public void setListDataProvinsi(List<Provinsi> listDataProvinsi) {
    this.listDataProvinsi = listDataProvinsi;


GetKota ( Second Spinner )

public class GetKota {

List<Kota> listDataKota;

public List<Kota> getListDataKota() {
    return listDataKota;
public void setListDataKota(List<Kota> listDataKota) {
    this.listDataKota = listDataKota;


First Spinner to get all data. I'm trying to select the id to populate second spinner from the adapter.

private void getAllProvinsi() {

    Call<GetProvinsi> kontakCall = mApiInterface.getProvinsi();
    kontakCall.enqueue(new Callback<GetProvinsi>() {
        public void onResponse(Call<GetProvinsi> call, Response<GetProvinsi>
                response) {

what's your interest