B4A Library MultiSelectSpinner V1.0.2

ruy

Member
Licensed User
Longtime User
I am adding the multiselectspinner programatically to a customlistview but, when clicked, sends

android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application

any suggestion
 

Prosg

Active Member
Licensed User
Longtime User
Hello,

I would like to know if your multislectspinner works with map key/value ?

I need somethink like this but with multiselect

spinNiveauDiplomeMap.Initialize
Dim Cursor1 As Cursor
Cursor1 = Main.SQL1.ExecQuery("SELECT id, niveau FROM niveau")
For i = 0 To Cursor1.RowCount - 1
Cursor1.Position = i
spinNiveauDiplome.Add (Cursor1.GetString("niveau"))
spinNiveauDiplomeMap.Put(Cursor1.GetString("niveau"), Cursor1.GetString("id"))
Next
Cursor1.Close


I try this : no success^^ maybe impossible ?

msspinnerMap.Initialize
msspinner.Items = Array As String(msspinnerMap.Put("test1", 1),msspinnerMap.Put("test2",2),msspinnerMap.Put("test3", 3),msspinnerMap.Put("test4", 4))
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
you need to set ITEMS...

try something like

B4X:
    Dim Cursor1 As Cursor
    Cursor1 = Main.SQL1.ExecQuery("SELECT id, niveau FROM niveau")
    Dim sparr(Cursor1.RowCount-1) As String
    For i = 0 To Cursor1.RowCount - 1
        Cursor1.Position = i
        sparr(i) = Cursor1.GetString("niveau")
        'spinNiveauDiplome.Add (Cursor1.GetString("niveau"))
        spinNiveauDiplomeMap.Put(Cursor1.GetString("niveau"), Cursor1.GetString("id"))
    Next
    spinNiveauDiplome.Items = sparr
    Cursor1.Close
 

Prosg

Active Member
Licensed User
Longtime User
ty for your help

They are 6 rows in the datatable

i have a bug : java.lang.ArrayIndexOutOfBoundsException: length=5; index=5

for this line
sparr(i) = Cursor1.GetString("niveau")

i can't explain why
 

LucaMs

Expert
Licensed User
Longtime User

try so
 

Prosg

Active Member
Licensed User
Longtime User
 

Attachments

  • upload_2015-11-7_17-48-56.png
    37.9 KB · Views: 191

Prosg

Active Member
Licensed User
Longtime User
It's crash the app when i click the spinnermultiselect if i don't use the designer

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim msspinner As MultiSelectSpinner
Dim p As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
' Activity.LoadLayout("Layout1")
msspinner.Initialize("")
msspinner.AddToParent(Activity, 0,0 ,300dip,100dip)
msspinner.Items = Array As String("Apple","Banana","Coconut","Kiwi","Strawberry")
msspinner.Selection = Array As String("Apple","Banana","Strawberry")

End Sub

The question is : How can i have this multiselectspinner without add it by designer ?
 
Last edited:

imbault

Well-Known Member
Licensed User
Longtime User
Hi @DonManfred ,

Asking the same question, is it possible to have your multiselectspinner without add it by designer?

Thanks
 

imbault

Well-Known Member
Licensed User
Longtime User

There is a way to do it, but you did to add a MultiSelectSpinner in the designer :
then in your code, you remove it from Activity then add it somewhere else:


B4X:
    Activity.LoadLayout("Layout1")
    Activity.RemoveViewAt(indexoftheMultSelectSpinner)   
    msspinner.AddToParent(Activity, 0,0 ,300dip,100dip)
 

imbault

Well-Known Member
Licensed User
Longtime User
In the case
.SelectAllOnFirst = True
each time I click the first line, this create an new instance of the view...

Is that a bug Manfred?

Thanks
 

RauchG

Active Member
Licensed User
Longtime User
Hello DonManfred,

if i have a device with an SDK >= 22, includes the multi-spinner when you click on the screen.

In the case of devices SDK < 22 is the only close on the Back-Key.

There is a trick?

Greeting RauchG
 

T201016

Active Member
Licensed User
Longtime User
Hello
I would add my own wish to other people regarding
your interesting solution. Well, with more than a few items to choose from the list
this first element could always be on top. Such a small streamlining case

And the question was, did you manage to fix the fault reported by Johna selecting the first item?

greetings
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…