Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- ActivityMainBinding.inflate(layoutInflater).apply {
- with(sCountry) {
- adapter =
- ArrayAdapter(
- this,
- R.layout.item_country,
- R.id.tvCountry,
- OperatedCountry.values()
- )
- onItemSelectedListener =
- object : AdapterView.OnItemSelectedListener {
- override fun onItemSelected(
- parent: AdapterView<*>,
- view: View?,
- position: Int,
- id: Long
- ) {
- if (view != null) {}
- }
- override fun onNothingSelected(parent: AdapterView<*>) {}
- }
- }
- setContentView(binds.root)
- }
- }
- }
- enum class OperatedCountry(val countryCode: String, val icon: Int) {
- RUSSIANFEDERATION("RU", R.drawable.flag_400),
- UKRAINE("UK", R.drawable.flag_401),
- TURKEY("TR", R.drawable.flag_402),
- }
Add Comment
Please, Sign In to add comment