# DropHelper.Options.Builder

# DropHelper.Options.Builder

Artifact:[androidx.draganddrop:draganddrop](https://developer.android.com/jetpack/androidx/releases/draganddrop)  
[View Source](https://cs.android.com/search?q=file:androidx/draganddrop/DropHelper.java+class:androidx.draganddrop.DropHelper.Options.Builder)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/draganddrop#1.0.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/draganddrop/DropHelper.Options.Builder "View this page in Java")

<br />

```
class DropHelper.Options.Builder
```

<br />

*** ** * ** ***

Builder for constructing a[DropHelper.Options](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options)instance.

## Summary

|                                                 ### Public constructors                                                 |
|-------------------------------------------------------------------------------------------------------------------------|
| [Builder](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options.Builder#Builder())`()` |

|                                                     ### Public functions                                                     |
|------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [DropHelper.Options.Builder](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options.Builder) | [addInnerEditTexts](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options.Builder#addInnerEditTexts(android.widget.EditText...))`(editTexts: `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[EditText](https://developer.android.com/reference/android/widget/EditText.html)`!>)` Enables you to specify the[EditText](https://developer.android.com/reference/android/widget/EditText.html)elements contained within the drop target. |
| [DropHelper.Options](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options)                 | [build](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options.Builder#build())`()` Builds a new[DropHelper.Options](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options)instance.                                                                                                                                                                                                                                                       |
| [DropHelper.Options.Builder](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options.Builder) | [setAcceptDragsWithLocalState](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options.Builder#setAcceptDragsWithLocalState(boolean))`(acceptDragsWithLocalState: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Sets whether or not the app should respond to drag events when the drag operation contains[local state](https://developer.android.com/reference/android/view/DragEvent.html#getLocalState()).                      |
| [DropHelper.Options.Builder](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options.Builder) | [setHighlightColor](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options.Builder#setHighlightColor(int))`(highlightColor: @`[ColorInt](https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Sets the color of the drop target highlight.                                                                                                                         |
| [DropHelper.Options.Builder](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options.Builder) | [setHighlightCornerRadiusPx](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options.Builder#setHighlightCornerRadiusPx(int))`(highlightCornerRadiusPx: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Sets the corner radius of the drop target highlight.                                                                                                                                                                                 |

## Public constructors

### Builder

Added in 1.0.0  

```
Builder()
```  

## Public functions

### addInnerEditTexts

```
fun addInnerEditTexts(editTexts: Array<EditText!>): DropHelper.Options.Builder
```

Enables you to specify the[EditText](https://developer.android.com/reference/android/widget/EditText.html)elements contained within the drop target. To ensure proper drop target highlighting, all`EditText`elements in the drop target view hierarchy must be included in a call to this method. Otherwise, an`EditText`within the target, rather than the target view itself, acquires focus during the drag and drop operation.

If the user is dragging text data and URI data in the drag and drop[ClipData](https://developer.android.com/reference/android/content/ClipData.html), one of the`EditText`elements in the drop target is selected to handle the text data. Selection is based on the following order of precedence:

1. The`EditText`(if any) on which the`ClipData`was dropped
2. The`EditText`(if any) that contains the text cursor (caret)
3. The first`EditText`provided in`editTexts`

To set the default`EditText`, make it the first argument of the`editTexts`parameter. For example, if your drop target handles images and contains two editable text fields, T1 and T2, make T2 the default by calling`addInnerEditTexts(T2, T1)`.

**Note:** Behavior is undefined if`EditText`s are added to or removed from the drop target after this method has been called.

See[DropHelper](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper)for more information.  

|                                                                                     Parameters                                                                                      |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|
| `editTexts: `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[EditText](https://developer.android.com/reference/android/widget/EditText.html)`!>` | The`EditText`elements contained in the drop target. |

|                                                           Returns                                                            |
|------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|
| [DropHelper.Options.Builder](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options.Builder) | This[DropHelper.Options.Builder](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options.Builder)instance. |

### build

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/draganddrop#1.0.0)  

```
fun build(): DropHelper.Options
```

Builds a new[DropHelper.Options](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options)instance.  

|                                                   Returns                                                    |
|--------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|
| [DropHelper.Options](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options) | A new[DropHelper.Options](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options)instance. |

### setAcceptDragsWithLocalState

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/draganddrop#1.0.0)  

```
fun setAcceptDragsWithLocalState(acceptDragsWithLocalState: Boolean): DropHelper.Options.Builder
```

Sets whether or not the app should respond to drag events when the drag operation contains[local state](https://developer.android.com/reference/android/view/DragEvent.html#getLocalState()). By default, the app does not respond to drag events that have local state. Setting local state is only possible when the drag operation originated from the current activity.

**Note:** To elicit the default behavior of ignoring drags from the same activity as the drop target, the local state supplied when starting the drag (via[startDragAndDrop](https://developer.android.com/reference/android/view/View.html#startDragAndDrop(android.content.ClipData, android.view.View.DragShadowBuilder, java.lang.Object, int))or using[androidx.core.view.DragStartHelper](https://developer.android.com/reference/kotlin/androidx/core/view/DragStartHelper)) must be non-null.  

|                                                    Parameters                                                    |
|------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------|
| `acceptDragsWithLocalState: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | Whether or not to accept drag events with non-null local state. |

|                                                           Returns                                                            |
|------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|
| [DropHelper.Options.Builder](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options.Builder) | This[DropHelper.Options.Builder](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options.Builder)instance. |

### setHighlightColor

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/draganddrop#1.0.0)  

```
fun setHighlightColor(highlightColor: @ColorInt Int): DropHelper.Options.Builder
```

Sets the color of the drop target highlight. The highlight is shown during a drag and drop operation when data is dragged over the drop target and a MIME type in the[ClipDescription](https://developer.android.com/reference/android/content/ClipDescription.html)matches a MIME type provided to[DropHelper#configureView](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper#configureView(android.app.Activity,android.view.View,java.lang.String[],androidx.core.view.OnReceiveContentListener)).

**Note:**Opacity, if provided, is ignored.  

|                                                                                        Parameters                                                                                        |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------|
| `highlightColor: @`[ColorInt](https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The highlight color. |

|                                                           Returns                                                            |
|------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|
| [DropHelper.Options.Builder](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options.Builder) | This[DropHelper.Options.Builder](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options.Builder)instance. |

### setHighlightCornerRadiusPx

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/draganddrop#1.0.0)  

```
fun setHighlightCornerRadiusPx(highlightCornerRadiusPx: Int): DropHelper.Options.Builder
```

Sets the corner radius of the drop target highlight. The highlight is shown during a drag and drop operation when data is dragged over the drop target and a MIME type in the[ClipDescription](https://developer.android.com/reference/android/content/ClipDescription.html)matches a MIME type provided to[DropHelper#configureView](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper#configureView(android.app.Activity,android.view.View,java.lang.String[],androidx.core.view.OnReceiveContentListener)).  

|                                               Parameters                                               |
|--------------------------------------------------------------------------------------------------------|----------------------------------------|
| `highlightCornerRadiusPx: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The highlight corner radius in pixels. |

|                                                           Returns                                                            |
|------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|
| [DropHelper.Options.Builder](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options.Builder) | This[DropHelper.Options.Builder](https://developer.android.com/reference/kotlin/androidx/draganddrop/DropHelper.Options.Builder)instance. |