Win a copy of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

How to save data from spinner to SQLite?

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello! I'm brand new-ish to app development so here's what I'm trying to do
1.Take the selected option from the spinner(there are two), convert it to string, and then save it to SQLite database for viewing it using a card view.
2.The issue I'm facing here is that in the lines 64 and 65 of the third code block setText is obviously wrong. I don't know what else I should do to prevent this error and make the holder work.









 
Malavika Shanker
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Spinner here is for meal and spinner2 here us for difficulty level!!!
 
Master Rancher
Posts: 572
9
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I'm facing here is that in the lines 64 and 65 of the third code block setText is obviously wrong.


What's the error?
 
Randy Tong
Master Rancher
Posts: 572
9
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Malavika Shanker wrote:Spinner here is for meal and spinner2 here us for difficulty level!!!


And what you get now?  
 
Malavika Shanker
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It says cannot resolve method setText in spinner
 
Randy Tong
Master Rancher
Posts: 572
9
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use setSelection instead of setText. Get the position of recipe.getMeal() from your spinner and set to it.

Here the example
 
Saloon Keeper
Posts: 6896
163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the future, please do not start several topics for the same question, especially if you have answers already. I have now closed the other one where you asked essentially the same question.
 
What a show! What atmosphere! What fun! What a tiny ad!
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic