In my layout xml I have a spinner and in my java I have a database with contacts and some values on it so I want to know how I send or put these values from the database in the spinner so when I click it, it selects the contact, any example of code?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Get the contacts details from the database first. You can find a sample code for database concept at http://codinglookseasy.blogspot.in/2012/08/sqlite-database.html . Next from the above sample you may have got ArrayList of objects and set the contact names in the spinner using a
Where list here may be the data from your ArrayList from the database. (store a specific field that you want to display from the database into this list). Get the item selected using
which gives the item selected and get the data using from the ArrayList that you got from the database
Just try
Consider you in main Activty
Now getContacts() containsas follows :
In DbHelper.java