0

I tried the accepted solution here: startDrag method Deprecated and unable to compile the program

So:

 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
     view.startDragAndDrop(data, shadowBuilder, view, 0);
 } else {
     view.startDrag(data, shadowBuilder, view, 0);
 }

But "startDrag" is crossed out and I have an error saying that it is deprecated, which means I can't compile.

I looked here: https://developer.android.com/guide/topics/ui/drag-drop.html

But the example they give is the deprecated solution:

  v.startDrag(dragData,  // the data to be dragged
              myShadow,  // the drag shadow builder
              null,      // no need to use local data
              0          // flags (not currently used, set to 0)
  );

So what can I use?

Laazo
  • 467
  • 8
  • 22
Code Poet
  • 6,222
  • 2
  • 29
  • 50

1 Answers1

1

Actually, you can compile deprecated functions try to press the run button.

Deprecated means that this function will be left as is even if there is a bug and there is currently a better alternative that will be updated regularly if it has problems.

This is a question about your error.

Android Admirer
  • 2,310
  • 2
  • 17
  • 38