Simple spinner question

jschuchert

Active Member
Licensed User
Longtime User
I haven't used a spinner before but think I might now. I used the designer to put one on my layout, then populated it with some things using 'add'. After closing and reopening the app, the spinner does not have the items. How do I retain them? The spinner is declared under globals. I looked at many spinner posts but my question was not addressed. Probably a no-brainer.

Its purpose is to add a job name each time the user enters one in an edittext in the same activity. Then on subsequent sessions they can scroll through the list of jobs to pick the one they want, select it and it will transfer to the edittext for further processing. I don't have a lot of room so the spinner could be the way to go.

Incidentally, the email notification did not work for my last message. Wonder if the forum is having an issue.

Jim
 
Last edited:

jschuchert

Active Member
Licensed User
Longtime User
B4X:
Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.

Dim txtFilename As EditText 
Dim txtDistMult As EditText 
Dim txtdecimal As EditText 
Dim spinner1 As Spinner 
Dim chkAzimuth As CheckBox 
Dim chkFile As CheckBox 
Dim btnOK As Button 
Dim btnMenu As Button 
Dim btnExit As Button 
Dim writer As TextWriter 
dim btnok2 As Button 
End Sub

Sub Activity_Create(FirstTime As Boolean)
activity.LoadLayout ("start")
txtfilename.RequestFocus 
End Sub

Sub btnOK_click
strfilename=txtFileName.text & ".txt"
If chkFile.Checked =True Then
File.OpenOutput (File.DirRootExternal ,strfilename,True)
Else
writer.initialize(File.OpenOutput (File.DirInternal ,strfilename,True))
End If 
If chkazimuth.Checked =True Then
intaz=1
Else
intaz=0
End If
dm=txtDistMult.Text 

spinner1.Add (txtfilename.Text )  <<<<<<this is where I add the jobs

End Sub

Erel, after reading your response, I suspect I need to do something else in 'create activity'
Again no email notification.
Jim
 
Upvote 0

jschuchert

Active Member
Licensed User
Longtime User
The layout is loaded first. Nothing is added to the spinner until the user enters a name in the edittext box and clicks OK. I just want to find out how to retain the spinner contents. All of the spinner examples I have seen apparently add the spinner view without the designer. Should I do the same and just get the dips from the layout? I only want the user to be able to see the jobs he has used before.

Jim
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
Again no email notification.
After several years of working OK a couple of months ago I too stopped receiving email notifications. The forum doesn't seem to like my "proper" email address anymore. I had to set up a new gmail account with automatic redirection and deletion in order to start receiving forum notifications again. :(
 
Upvote 0

jschuchert

Active Member
Licensed User
Longtime User
That's pretty weird. I thought the email address was tied to the posts, etc. Whenever I enter the forum, it welcomes me without a separate sign on and says I "may' make new posts. If it didn't think my email was valid I didn't think it would recognize me.
 
Upvote 0

jschuchert

Active Member
Licensed User
Longtime User
I think I understand the spinner a little better now that I have experimented. It apparently doesn't like additions 'on the fly' so I will have to devise a way to save the users' entries in a separate file and then load that into the spinner after it creates the view. It worked a bit differently in b4ppc. I may be making a mountain out of a mole hill and should just have the users record their files externally.

Jim
 
Upvote 0

jschuchert

Active Member
Licensed User
Longtime User
Guess what? Your message came through as an email notification. But thanks for the info. I should have known that.
 
Upvote 0
Top