Android Spanned Create spannedFromByteArray(byte[] byteArray)

Here you can find the source of spannedFromByteArray(byte[] byteArray)

Description

spanned From Byte Array

License

Apache License

Declaration

public static Spanned spannedFromByteArray(byte[] byteArray) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import android.os.Parcel;

import android.text.Spanned;
import android.text.TextUtils;

public class Main {
    public static Spanned spannedFromByteArray(byte[] byteArray) {
        if (byteArray == null) {
            return null;
        }//from  w  w  w .ja va2s .  c o m
        Parcel obtain = Parcel.obtain();
        obtain.unmarshall(byteArray, 0, byteArray.length);
        obtain.setDataPosition(0);
        Spanned result = (Spanned) TextUtils.CHAR_SEQUENCE_CREATOR
                .createFromParcel(obtain);
        obtain.recycle();
        return result;
    }
}