根据每个微调器选择,从webservice填充活动中的Multiple(4)微调器

时间:2016-12-09 07:11:10

标签: android xml web-services android-spinner dynamic-data

This is the layout ,I am going have in a activity

populate spinner的数据完全来自webservice(xml)。 应用程序不会为微调器数据填充维护任何本地数据......

我需要通过动态方式使用webservice逐个选择微调器值来获取每个微调器值。 通过webservice填充国家/地区。 基于国家,通过webservice填充城市。 基于国家和城市,通过webservice填充密码。 根据国家,城市和密码,通过webservice填充bank_name并继续。

如何顺利实现这一目标,以获得更好的用户界面 .....

1 个答案:

答案 0 :(得分:0)

    If you are recieving array value of all spiiners in api then you also need the values which is select by default in that api.


    i.e
    {
    data:{
    city:[
    "X",
    "Y",
    "Z"
    ]
    },
    dataSelected:{
    city:"X"
    }
    }

//after parsing

spinnerCity.setadaper(new ArrayAdapter<String>(getActivity(), R.layout.layout_simple_spinner_dropdown_table, arrCity));

 String selectedStr = "X";
                        String cap = selectedStr.substring(0, 1).toUpperCase() + selectedStr.substring(1);
                        int spinnerPosition = arrCity.indexOf(cap);
                        spinnerCity.setSelection(spinnerPosition);