-
-
Save codeforfun-jp/4c71fa98cbb680168c2c24a5cde8dc89 to your computer and use it in GitHub Desktop.
【Kotlin】ListView with searchview 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
val data = listOf( | |
"あだち", "いのうえ", "うえき", "うえだ", | |
"うえと", "うちだ", "うちの", "うつみ", "うの", "えとう", "おおた" | |
) | |
// ListViewにデータをセットする | |
val list = findViewById<ListView>(R.id.list) | |
list.adapter = ArrayAdapter( | |
this, | |
android.R.layout.simple_list_item_1, | |
data | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment