ContentRecommendation.Builder

public static final class ContentRecommendation.Builder
extends Object

java.lang.Object
   ↳ androidx.recommendation.app.ContentRecommendation.Builder


Builder class for ContentRecommendation objects. Provides a convenient way to set the various fields of a 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();
 

Summary

Public constructors

Builder()

Constructs a new Builder.

Public methods

ContentRecommendation build()

Combine all of the options that have been set and return a new ContentRecommendation object.

ContentRecommendation.Builder setAutoDismiss(boolean autoDismiss)

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

ContentRecommendation.Builder setBackgroundImageUri(String imageUri)

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

ContentRecommendation.Builder setBadgeIcon(int iconResourceId)

Sets the resource ID for the recommendation badging icon.

ContentRecommendation.Builder setColor(int color)

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

ContentRecommendation.Builder setContentImage(Bitmap image)

Sets the recommendation image.

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.

ContentRecommendation.Builder setContentTypes(String[] types)

Sets the content types associated with the content recommendation.

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.

ContentRecommendation.Builder setGenres(String[] genres)

Sets the content genres for the recommendation.

ContentRecommendation.Builder setGroup(String groupTag)

Sets the String group ID tag for the recommendation.

ContentRecommendation.Builder setIdTag(String idTag)

Sets the Id tag that uniquely identifies this recommendation object.

ContentRecommendation.Builder setMaturityRating(String maturityRating)

Sets the maturity level rating for the content.

ContentRecommendation.Builder setPricingInformation(String priceType, String priceValue)

Sets the pricing and availability information for the recommendation.

ContentRecommendation.Builder setProgress(int max, int progress)

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

ContentRecommendation.Builder setRunningTime(long length)

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

ContentRecommendation.Builder setSortKey(String sortKey)

Sets the String sort key for the recommendation.

ContentRecommendation.Builder setSourceName(String source)

Sets the source application name for the recommendation.

ContentRecommendation.Builder setStatus(int contentStatus)

Sets the availability status for the content.

ContentRecommendation.Builder setText(String description)

Sets the description text for the recommendation.

ContentRecommendation.Builder setTitle(String title)

Sets the content title for the recommendation.

Inherited methods

Public constructors

Builder

public Builder ()

Constructs a new Builder.

Public methods