Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I include MIMETYPE_TEXT_PLAIN in the creation of a ClipData object?

Tags:

java

android

I'm making an object draggable in an App (following android developer's guide for this), and it looks like this:

ClipData dragData = new ClipData(v.getTag(), ClipData.MIMETYPE_TEXT_PLAIN, item);

But the IDE gives the following error:

Cannot resolve symbol 'MIMETYPE_TEXT_PLAIN'

So my question is this: How can I make the IDE recognize the MIMETYPE_TEXT_PLAIN?

And yes, I've tried (what seems that should be the correct way) to change ClipData.MIMETYPE_TEXT_PLAIN to ClipDescription.MIMETYPE_TEXT_PLAIN but that just seems to make everything worse, like you can see in the following screenshot:

enter image description here

like image 505
Lorenz Avatar asked May 03 '15 18:05

Lorenz


1 Answers

You need to use type CharSequence for first and String array for second parameter.

ClipData dragData = new ClipData((CharSequence) v.getTag(), 
                                 new String[]{ ClipDescription.MIMETYPE_TEXT_PLAIN }, item); 
like image 114
Manish Avatar answered Oct 22 '22 17:10

Manish