Help with Android Kotlin Drag and Drop function. Where drop() is not being called!
Budget: €8 – €30 EUR
When I implement a drop() function (as asked for by IDE) the program runs but code in 'override fun drop()' isn't executed at all when dropping the Image. The fun drag() is working fine. But the implemented fun drop() is ignored. Side note: Android Studio (2021.1.1) is asking for drop() but DragAndDrop.java doesn't even have drop(). It has drag() and dragStop(). Ofcourse, dragStop() I tried to implement but the error comes up again that says Kotlin doesn't seem to want the dragStop, rather the never called drop() function. Any ideas on why drop() is never called?
dragAndDrop.addTarget(object : DragAndDrop.Target(sourcemap_input) {
override fun drag(
source: DragAndDrop.Source?,
payload: Payload?,
x: Float,
y: Float,
pointer: Int
): Boolean {
print(4)
return true
}
override fun drop(
source: DragAndDrop.Source?,
payload: Payload?,
x: Float,
y: Float,
pointer: Int
) {
print(5)
}
})
dragAndDrop.addTarget(object : DragAndDrop.Target(sourcemap_input) {
override fun drag(
source: DragAndDrop.Source?,
payload: Payload?,
x: Float,
y: Float,
pointer: Int
): Boolean {
print(4)
return true
}
override fun drop(
source: DragAndDrop.Source?,
payload: Payload?,
x: Float,
y: Float,
pointer: Int
) {
print(5)
}
})
Related categories:
Business, Accounting, Human Resources & Legal
Mobile App Development
Android
Game Development
Kotlin