Spinner Value Selection Printing, Saving

Hi I am trying to help develop my son a simple application using vegetables and fruits. We are using Spinner to select the quantity to order for a given vegetable or fruit. He has all vegetables in one screen and fruits in another screen. I have the following questions

  1. How do i save the selections of a spinner in a file temporarily ( without using any db)
  2. How do i print the selections of spinner to say an SMS or WhatsAPP in a phone
  3. How do i clear the spinner selections in a screen.
  4. While navigating between fruits and vegetables how do i retain my spinner selections


Hi Venkat. Welcome to the Forum.

What have you tried so far?

1). The easiest way to save the selections of your Spinner, even temporarily is to use a TinyDb on both your main and other Screen.

2). Use the Texting component to send an sms. Exactly what you do depends on how you provide a List of your vegetable/fruit selections. We do not know because you did not provide an image of your code blocks.

3). Use a TinyDB in the Screen1 and Screen2 Screen.Initialize Blocks to ‘refresh’ the Spinner selections.

Here are some resources to help you learn to use the AI2 tools. A very good way to learn App Inventor is to read the free Inventor’s Manual here in the AI2 free online eBook http://www.appinventor.org/book2 … the links are at the bottom of the Web page. The book ‘teaches’ users how to program with AI2 blocks.

There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles

How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/content/howDoYou/eventHandling .

Also look here http://kio4.com/appinventor/index.htm and here http://www.imagnity.com/tutorial-index/ for more tutorials.


Thanks Steve for the quick response.

  1. Here is the main screen - This is where the navigation starts
  2. Here is the Vegetable and Fruits screens with the spinner values
  3. Here is the copy of the designer he uses for spinner selection and after selecting the selection turns to green ( his way of telling the user he /she has selected it)

    He attempted some varibale blokc but we could not proceed further -

As i said earlier - The selections from this will have to be stored and then printed - Print can be in the home screen or in the fruits or vegetable screen…


Switching and using multiple screens, using Spinners are difficult for a beginner. Using multiple Spinners is not necessary if you guys are willing to consider a design change.

I did a similar app on a single screen. The example eliminates the need for all but two Spinners you guys proposed. It eliminates the problem of moving variables and information between Screens.

If you design your app this way using two ListPickers instead of item/number of items screen image you showed, all the vegetables are reported in Label2; all the fruits are shown in a Label1. The information can be stored in a TinyDB, is already ‘printed’ on the screen. The contents of the Label can be used to provide the Message in the Texting component as long as the Message is less than 170 characters (see below).

The message that will be sent when the SendMessage method is called. The maximum length of a standard SMS message is usually 170. It may be less for languages using diacritical marks.

This example may help you design your son’s app. The example has minimal error control. The Clear button ‘erases’ everything. You guys need to provide any additional features. If you want to provide item/number of items, you can still do your app the way you suggest using some of the techniques shown in this example.

shop fruit


GroceryList.aia (7.4 KB)


Thank You Steve - This worked - He was very excited. He is now trying to understand the code construct. He added a lot of fruits and vegetables…to the list

Thanks !


1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.