Hi,
I was able to use a DraggableView if the used View (in my case an ImageView) was added to the designer. What I'm trying to do is to add several DraggableViews by code, however I got stuck.
My Code so far:
The comments show what I tried to do. However I get an error in the line "dvCards.Initialize(Activity,ivCard)" (in German: "Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt." my translation: the Object was not set to an object-instance).
IMHO "Activity" is correctly set (I'm using it in the same way as when using the view that was added in the designer), so it has to be "ivCard", but WHY?
I was able to use a DraggableView if the used View (in my case an ImageView) was added to the designer. What I'm trying to do is to add several DraggableViews by code, however I got stuck.
My Code so far:
B4X:
Sub Globals
Dim Cards As List 'shall hold the List of ImageViews
Dim dvCards As List 'shall hold the List of draggableViews
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("layoutMain") 'this layout is empty
Dim i As Int
Cards.Initialize 'initialize the List
dvCards.Initialize 'initialize the List
For i =0 To 20
Dim ivCard As ImageView 'declare an ImageView, for each loop a new one!
ivCard.Initialize("ivCard") 'intialize the ImageView
Cards.Add(ivCard) 'add it to the List
Dim dvCard As clDraggableView 'declare an DraggableView, for each loop a new one
dvCards.Initialize(Activity,ivCard)'intialize the DraggableView
dvCards.Add(dvCard) 'add it to the List
Next
End Sub
IMHO "Activity" is correctly set (I'm using it in the same way as when using the view that was added in the designer), so it has to be "ivCard", but WHY?
Last edited: