added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)   
belongs to Maven artifact com.android.support:recommendation:28.0.0-alpha1 Summary: [Ctors](https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#inhmethods) \| [\[Expand All\]](https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#)

# ContentRecommendation.Builder


`
public
static
final

class
ContentRecommendation.Builder
`


`

extends Object


`

`


`

|---|---|
| java.lang.Object ||
| ↳ | android.support.app.recommendation.ContentRecommendation.Builder |

<br />

*** ** * ** ***

Builder class for `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation` objects. Provides a convenient way to set the
various fields of a `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation`.


Example:

```
 ContentRecommendation rec = new ContentRecommendation.Builder()
         .setIdInfo(id, "MyTagId")
         .setTitle("My Content Recommendation")
         .setText("An example of content recommendation")
         .setContentImage(myBitmap)
         .setBadgeIcon(R.drawable.app_icon)
         .setGroup("Trending")
         .build();
 
```

<br />

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#ContentRecommendation.Builder()() ` Constructs a new Builder. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation` | ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#build()() ` Combine all of the options that have been set and return a new `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation` object. |
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#setAutoDismiss(boolean)(boolean autoDismiss) ` Sets the flag indicating if the recommendation should be dismissed automatically. |
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#setBackgroundImageUri(java.lang.String)(String imageUri) ` Sets the Content URI that will be used to retrieve the background image for the recommendation. |
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#setBadgeIcon(int)(int iconResourceId) ` Sets the resource ID for the recommendation badging icon. |
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#setColor(int)(int color) ` Sets the accent color value to be used in the UI when displaying this content recommendation to the user. |
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#setContentImage(android.graphics.Bitmap)(https://developer.android.com/reference/android/graphics/Bitmap.html image) ` Sets the recommendation image. |
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#setContentIntentData(int, android.content.Intent, int, android.os.Bundle)(int intentType, https://developer.android.com/reference/android/content/Intent.html intent, int requestCode, https://developer.android.com/reference/android/os/Bundle.html options) ` Sets the data for the Intent that will be issued when the user clicks on the recommendation. |
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#setContentTypes(java.lang.String[])(String[] types) ` Sets the content types associated with the content recommendation. |
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#setDismissIntentData(int, android.content.Intent, int, android.os.Bundle)(int intentType, https://developer.android.com/reference/android/content/Intent.html intent, int requestCode, https://developer.android.com/reference/android/os/Bundle.html options) ` Sets the data for the Intent that will be issued when the recommendation gets dismissed from the Home Screen, due to an user action. |
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#setGenres(java.lang.String[])(String[] genres) ` Sets the content genres for the recommendation. |
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#setGroup(java.lang.String)(String groupTag) ` Sets the String group ID tag for the recommendation. |
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#setIdTag(java.lang.String)(String idTag) ` Sets the Id tag that uniquely identifies this recommendation object. |
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#setMaturityRating(java.lang.String)(String maturityRating) ` Sets the maturity level rating for the content. |
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#setPricingInformation(java.lang.String, java.lang.String)(String priceType, String priceValue) ` Sets the pricing and availability information for the recommendation. |
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#setProgress(int, int)(int max, int progress) ` Sets the progress information for the content pointed to by the recommendation. |
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#setRunningTime(long)(long length) ` Sets the running time (when applicable) for the content. |
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#setSortKey(java.lang.String)(String sortKey) ` Sets the String sort key for the recommendation. |
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#setSourceName(java.lang.String)(String source) ` Sets the source application name for the recommendation. |
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#setStatus(int)(int contentStatus) ` Sets the availability status for the content. |
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#setText(java.lang.String)(String description) ` Sets the description text for the recommendation. |
| ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | ` https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#setTitle(java.lang.String)(String title) ` Sets the content title for the recommendation. |

| ### Inherited methods |
|---|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder#)From class ` java.lang.Object ` |---|---| | ` Object` | ` clone() ` | | ` boolean` | ` equals(Object arg0) ` | | ` void` | ` finalize() ` | | ` final Class<?>` | ` getClass() ` | | ` int` | ` hashCode() ` | | ` final void` | ` notify() ` | | ` final void` | ` notifyAll() ` | | ` String` | ` toString() ` | | ` final void` | ` wait(long arg0, int arg1) ` | | ` final void` | ` wait(long arg0) ` | | ` final void` | ` wait() ` | ||

## Public constructors

### ContentRecommendation.Builder

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation.Builder ()
```

Constructs a new Builder.

<br />

## Public methods

### build

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation build ()
```

Combine all of the options that have been set and return a new
`https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation` object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation` | <br /> |

### setAutoDismiss

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation.Builder setAutoDismiss (boolean autoDismiss)
```

Sets the flag indicating if the recommendation should be dismissed automatically.


Auto-dismiss notifications are automatically removed from the Home Screen when the user
clicks on them.

<br />

| Parameters ||
|---|---|
| `autoDismiss` | `boolean`: A boolean indicating if the recommendation should be auto dismissed or not. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | The Builder object, for chaining. <br /> |

### setBackgroundImageUri

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation.Builder setBackgroundImageUri (String imageUri)
```

Sets the Content URI that will be used to retrieve the background image for the
recommendation.

<br />

| Parameters ||
|---|---|
| `imageUri` | `String`: A Content URI pointing to the recommendation background image. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | The Builder object, for chaining. <br /> |

### setBadgeIcon

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation.Builder setBadgeIcon (int iconResourceId)
```

Sets the resource ID for the recommendation badging icon.


The resource id represents the icon resource in the source application package. If not
set, or an invalid resource ID is specified, the application icon retrieved from its
package will be used by default.

<br />

| Parameters ||
|---|---|
| `iconResourceId` | `int`: An integer id for the badge icon resource. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | The Builder object, for chaining. <br /> |

### setColor

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation.Builder setColor (int color)
```

Sets the accent color value to be used in the UI when displaying this content
recommendation to the user.

<br />

| Parameters ||
|---|---|
| `color` | `int`: An integer value representing the accent color for this recommendation. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | The Builder object, for chaining. <br /> |

### setContentImage

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation.Builder setContentImage (Bitmap image)
```

Sets the recommendation image.

<br />

| Parameters ||
|---|---|
| `image` | `Bitmap`: A Bitmap containing the recommendation image. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | The Builder object, for chaining. <br /> |

### setContentIntentData

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation.Builder setContentIntentData (int intentType, 
                Intent intent, 
                int requestCode, 
                Bundle options)
```

Sets the data for the Intent that will be issued when the user clicks on the
recommendation.


The Intent data fields provided correspond to the fields passed into the
`https://developer.android.com/reference/android/app/PendingIntent.html` factory methods, when creating a new PendingIntent. The actual
PengindIntent object will only be created at the time a recommendation is posted to the
Home Screen.

<br />

| Parameters ||
|---|---|
| `intentType` | `int`: The type of `https://developer.android.com/reference/android/app/PendingIntent.html` to be created when posting this recommendation. <br /> |
| `intent` | `Intent`: The Intent which to be issued when the recommendation is clicked on. <br /> |
| `requestCode` | `int`: The private request code to be used when creating the `https://developer.android.com/reference/android/app/PendingIntent.html` <br /> |
| `options` | `Bundle`: Only used for the Activity Intent type. Additional options for how the Activity should be started. May be null if there are no options. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | The Builder object, for chaining. <br /> |

### setContentTypes

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation.Builder setContentTypes (String[] types)
```

Sets the content types associated with the content recommendation. The first tag entry
will be considered the primary type for the content and will be used for ranking
purposes. Other secondary type tags may be provided, if applicable, and may be used for
filtering purposes.

<br />

| Parameters ||
|---|---|
| `types` | `String`: Array of predefined type tags (see the `CONTENT_TYPE_*` constants) that describe the recommended content. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | <br /> |

### setDismissIntentData

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation.Builder setDismissIntentData (int intentType, 
                Intent intent, 
                int requestCode, 
                Bundle options)
```

Sets the data for the Intent that will be issued when the recommendation gets dismissed
from the Home Screen, due to an user action.


The Intent data fields provided correspond to the fields passed into the
`https://developer.android.com/reference/android/app/PendingIntent.html` factory methods, when creating a new PendingIntent. The actual
PengindIntent object will only be created at the time a recommendation is posted to the
Home Screen.

<br />

| Parameters ||
|---|---|
| `intentType` | `int`: The type of `https://developer.android.com/reference/android/app/PendingIntent.html` to be created when posting this recommendation. <br /> |
| `intent` | `Intent`: The Intent which gets issued when the recommendation is dismissed from the Home Screen. <br /> |
| `requestCode` | `int`: The private request code to be used when creating the `https://developer.android.com/reference/android/app/PendingIntent.html` <br /> |
| `options` | `Bundle`: Only used for the Activity Intent type. Additional options for how the Activity should be started. May be null if there are no options. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | The Builder object, for chaining. <br /> |

### setGenres

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation.Builder setGenres (String[] genres)
```

Sets the content genres for the recommendation. These genres may be used for content
ranking. Genres are open ended String tags.


Some examples: "comedy", "action", "dance", "electronica", "racing", etc.

<br />

| Parameters ||
|---|---|
| `genres` | `String`: Array of genre string tags that describe the recommended content. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | <br /> |

### setGroup

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation.Builder setGroup (String groupTag)
```

Sets the String group ID tag for the recommendation.


Recommendations in the same group are ranked by the Home Screen together, and the sort
order within a group is respected. This can be useful if the application has different
sources for recommendations, like "trending", "subscriptions", and "new music" categories
for YouTube, where the user can be more interested in recommendations from one group than
another.

<br />

| Parameters ||
|---|---|
| `groupTag` | `String`: A String containing the group ID tag for this recommendation. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | The Builder object, for chaining. <br /> |

### setIdTag

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation.Builder setIdTag (String idTag)
```

Sets the Id tag that uniquely identifies this recommendation object.

<br />

| Parameters ||
|---|---|
| `idTag` | `String`: A String tag identifier for this recommendation. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | The Builder object, for chaining. <br /> |

### setMaturityRating

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation.Builder setMaturityRating (String maturityRating)
```

Sets the maturity level rating for the content.

<br />

| Parameters ||
|---|---|
| `maturityRating` | `String`: A tag indicating the maturity level rating for the content. This tag must be one of the predefined maturity rating tags (see the ` CONTENT_MATURITY_*` constants). <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | <br /> |

### setPricingInformation

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation.Builder setPricingInformation (String priceType, 
                String priceValue)
```

Sets the pricing and availability information for the recommendation. The provided
information will indicate the access model for the content (free, rental, purchase or
subscription) and the price value (if not free).

<br />

| Parameters ||
|---|---|
| `priceType` | `String`: Pricing type for this content. Must be one of the predefined pricing type tags (see the `CONTENT_PRICING_*` constants). <br /> |
| `priceValue` | `String`: A string containing a representation of the content price in the current locale and currency. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | <br /> |

### setProgress

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation.Builder setProgress (int max, 
                int progress)
```

Sets the progress information for the content pointed to by the recommendation.

<br />

| Parameters ||
|---|---|
| `max` | `int`: The maximum value for the progress of this content. <br /> |
| `progress` | `int`: The progress amount for this content. Must be in the range (0 - max). <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | The Builder object, for chaining. <br /> |

### setRunningTime

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation.Builder setRunningTime (long length)
```

Sets the running time (when applicable) for the content.

<br />

| Parameters ||
|---|---|
| `length` | `long`: The running time, in seconds, of the content. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | <br /> |

### setSortKey

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation.Builder setSortKey (String sortKey)
```

Sets the String sort key for the recommendation.


The sort key must be a String representation of a float number between 0.0 and 1.0, and
is used to indicate the relative importance (and sort order) of a single recommendation
within its specified group. The recommendations will be ordered in decreasing order of
importance within a given group.

<br />

| Parameters ||
|---|---|
| `sortKey` | `String`: A String containing the sort key for this recommendation. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | The Builder object, for chaining. <br /> |

### setSourceName

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation.Builder setSourceName (String source)
```

Sets the source application name for the recommendation.


If the source name is never set, or set to null, the application name retrieved from its
package will be used by default.

<br />

| Parameters ||
|---|---|
| `source` | `String`: A String containing the recommendation source name. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | The Builder object, for chaining. <br /> |

### setStatus

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation.Builder setStatus (int contentStatus)
```

Sets the availability status for the content. This status indicates whether the referred
content is ready to be consumed on the device, or if the user must first purchase, rent,
subscribe to, or download the content.

<br />

| Parameters ||
|---|---|
| `contentStatus` | `int`: The status value for this content. Must be one of the predefined content status values (see the `CONTENT_STATUS_*` constants). <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | <br /> |

### setText

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation.Builder setText (String description)
```

Sets the description text for the recommendation.

<br />

| Parameters ||
|---|---|
| `description` | `String`: A String containing the recommendation description text. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | The Builder object, for chaining. <br /> |

### setTitle

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContentRecommendation.Builder setTitle (String title)
```

Sets the content title for the recommendation.

<br />

| Parameters ||
|---|---|
| `title` | `String`: A String containing the recommendation content title. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder` | The Builder object, for chaining. <br /> |

-

  ## Annotations

  - [ContentRecommendation.ContentMaturity](https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.ContentMaturity)
  - [ContentRecommendation.ContentPricing](https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.ContentPricing)
  - [ContentRecommendation.ContentStatus](https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.ContentStatus)
  - [ContentRecommendation.ContentType](https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.ContentType)
  - [ContentRecommendation.IntentType](https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.IntentType)
-

  ## Classes

  - [ContentRecommendation](https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation)
  - [ContentRecommendation.Builder](https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.Builder)
  - [ContentRecommendation.IntentData](https://developer.android.com/reference/android/support/app/recommendation/ContentRecommendation.IntentData)
  - [RecommendationExtender](https://developer.android.com/reference/android/support/app/recommendation/RecommendationExtender)