Example usage for android.media.tv TvContentRating unflattenFromString

List of usage examples for android.media.tv TvContentRating unflattenFromString

Introduction

In this page you can find the example usage for android.media.tv TvContentRating unflattenFromString.

Prototype

public static TvContentRating unflattenFromString(String ratingString) 

Source Link

Document

Recovers a TvContentRating object from the string that was previously created from #flattenToString .

Usage

From source file:Main.java

public static TvContentRating[] stringToContentRatings(String commaSeparatedRatings) {
    if (TextUtils.isEmpty(commaSeparatedRatings)) {
        return null;
    }/*from  www . j  av a 2s  . c  om*/
    String[] ratings = commaSeparatedRatings.split("\\s*,\\s*");
    TvContentRating[] contentRatings = new TvContentRating[ratings.length];
    for (int i = 0; i < contentRatings.length; ++i) {
        contentRatings[i] = TvContentRating.unflattenFromString(ratings[i]);
    }
    return contentRatings;
}