Created
September 28, 2017 20:52
-
-
Save aneury1/07df93317f18d3a8ef665ed9e674b883 to your computer and use it in GitHub Desktop.
ArrayAdapter Android
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
ArrayList<String> amounts = new ArrayList<String>(); | |
amounts.add("1000"); | |
amounts.add("1200"); | |
amounts.add("1300"); | |
amounts.add("1400"); | |
amounts.add("1500"); | |
amounts.add("1600"); | |
ArrayAdapter<String> adapter1 = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, amounts); | |
ListView ms = (ListView)findViewById(R.id.testlist); | |
ms.setAdapter(adapter1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Spinner spinner = (Spinner) findViewById(R.id.spinner);
// Create an ArrayAdapter using the string array and a default spinner layout
ArrayAdapter adapter = ArrayAdapter.createFromResource(this,
R.array.planets_array, android.R.layout.simple_spinner_item);
// Specify the layout to use when the list of choices appears
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// Apply the adapter to the spinner
spinner.setAdapter(adapter);