Resizable Apps & Multi-Window Support in Android

Mar 30 2021 · Kotlin 1.4, Android 11, Android Studio 4

Part 1: Resizable Apps & Multi-Window Support in Android

08. Enable Drag & Drop Support: Part 2

Episode complete

About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 07. Enable Drag & Drop Support: Part 1

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Notes: 08. Enable Drag & Drop Support: Part 2

There are different ways to support multi-tasking in Android! Multi-Window mode is just one of the cool Android features that supports this.

If you want to try out different multi-tasking features, be sure to check out our Implementing Picture in Picture Mode In Android course.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

And the last thing you have to do to test your Drag & Drop feature is to enable listening for drops in Droppey.

<application
    android:resizeableActivity="true"/>
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
    enableDropListener()
  }
  private fun enableDropListener() {
    val notesDrop = findViewById<TextView>(R.id.notesDrop)

    notesDrop.setOnDragListener { _, event ->
      if (event.action == ACTION_DROP) {
        val notes = event.clipData.getItemAt(0).text

        notesDrop.text = notes
      }

      true
    }
  }