안녕하세요 제가 여행지 추천 어플을 기획하고 제작하고 있는데 스피너로 직렬화된 객체를 액티비티에 전달하여 그 여행지에 맞는 액티비티를 띄워주어 여행지 정보를 주는 프로그램을 만들고 있습니다
제가 해결하지 못하는 부분은 전달받은 리스트의 객체를 구분하여 조건문을 만들고 그 조건에 해당하고 넘겨받은 Country에 정보를 출력하고 싶습니다 ㅠㅠ 도와주세요 !!
private List<Country> getCountryList() {
List<Country> countryList = new ArrayList<Country>();
countryList.add(new Country("Select", "여행지를 선택해주세요."));
countryList.add(new Country("indonesia", "인도네시아"));
countryList.add(new Country("thailand", "태국"));
countryList.add(new Country("japan", "일본"));
countryList.add(new Country("switzerland", "스위스"));
return countryList;
}
public class CountryDetailsActivity extends AppCompatActivity {
private static final String COUNTRY = "Country";
public static void show(Context context, Country country) {
Intent intent = new Intent(context, CountryDetailsActivity.class);
intent.putExtra(COUNTRY, country);
context.startActivity(intent);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_country_details);
bindCountry();
}
private void bindCountry() {
Country country = (Country) getIntent().getSerializableExtra(COUNTRY);
Objects.requireNonNull(country);
}
}