Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. <Spinner
  2. android:id="@+id/spinState"
  3. android:layout_width="match_parent"
  4. android:layout_height="wrap_content"
  5. android:layout_marginTop="10dp"
  6. android:entries="@array/entry"
  7. />
  8.  
  9. private void getCity_State() {
  10. Call<List<City>> call = AppController.getInstance().getApiInterface().getCity();
  11. call.enqueue(new Callback<List<City>>() {
  12. @Override
  13. public void onResponse(Call<List<City>> call, Response<List<City>> response) {
  14.  
  15. if (response.body() != null)
  16. {
  17. city = response.body();
  18. ArrayList<String> City_States = new ArrayList<>();
  19.  
  20. for (int i=0;i<city.size();i++)
  21. {
  22. City_States.add(city.get(i).getCity_name());
  23.  
  24. }
  25. cityType.setAdapter(new ArrayAdapter<String>(SignUpEventActivity.this,android.R.layout.simple_list_item_1,City_States));
  26.  
  27. }
  28. }
  29.  
  30. @Override
  31. public void onFailure(Call<List<City>> call, Throwable t) {
  32.  
  33. }
  34. });
  35. }
  36.  
  37. public class City {
  38.  
  39.  
  40. @SerializedName("city_name")
  41. @Expose
  42. private String city_name;
  43.  
  44. @SerializedName("city_id")
  45. @Expose
  46. private int city_id;
  47.  
  48.  
  49. public int getCity_id() {
  50. return city_id;
  51. }
  52.  
  53. public void setCity_id(int city_id) {
  54. this.city_id = city_id;
  55. }
  56.  
  57. public String getCity_name() {
  58. return city_name;
  59. }
  60.  
  61. public void setCity_name(String city_name) {
  62. this.city_name = city_name;
  63. }
  64.  
  65.  
  66. }
  67.  
  68. @GET("city")
  69. Call<List<City>> getCity();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement