Android SDKバージョン


public class Utility
com.facebook.internal is solely for the use of other packages within the Facebook SDK for Android. Use of any of the classes in this package is unsupported, and they may be modified or removed without warning at any time.
Nested Class Summary
Modifier and TypeClassDescription
public interfaceUtility.GraphMeRequestWithCacheCallback
Field Summary
Modifier and TypeFieldDescription
private final StringLOG_TAG
private final IntegerDEFAULT_STREAM_BUFFER_SIZE
private final LocaleresourceLocale
private final LocalecurrentLocale
private final static BooleanisAutoAppLinkSetup
private final JSONObjectdataProcessingOptions
private final BooleanisDataProcessingRestricted
public final static UtilityINSTANCE
Method Summary
Modifier and TypeMethodDescription
final static BooleanisNullOrEmpty(Collection<?> c)
final static BooleanisNullOrEmpty(String s)
final static StringcoerceValueIfNullOrEmpty(String s, String valueIfNullOrEmpty) Use this when you want to normalize empty and null strings This way, Utility.areObjectsEqual can used for comparison, where a null string is to be treated the same as an empty string.
final static Stringmd5hash(String key)
final static Stringsha1hash(String key)
final static Stringsha1hash(ByteArray bytes)
final static Stringsha256hash(String key)
final static Stringsha256hash(ByteArray bytes)
final static UribuildUri(String authority, String path, Bundle parameters)
final static BundleparseUrlQueryString(String queryString)
final static UnitputNonEmptyString(Bundle b, String key, String value)
final static UnitputCommaSeparatedStringList(Bundle b, String key, List<String> list)
final static UnitputUri(Bundle b, String key, Uri uri)
final static BooleanputJSONValueInBundle(Bundle bundle, String key, Object value)
final static UnitcloseQuietly(Closeable closeable)
final static UnitdisconnectQuietly(URLConnection connection)
final static StringgetMetadataApplicationId(Context context)
final static Map<String, Object>convertJSONObjectToHashMap(JSONObject jsonObject)
final static Map<String, String>convertJSONObjectToStringMap(JSONObject jsonObject)
final static List<String>convertJSONArrayToList(JSONArray jsonArray)
final static ObjectgetStringPropertyAsJSON(JSONObject jsonObject, String key, String nonJSONPropertyKey)
final static StringreadStreamToString(InputStream inputStream)
final static IntegercopyAndCloseInputStream(InputStream inputStream, OutputStream outputStream)
final static BooleanstringsEqualOrEmpty(String a, String b)
final static UnitclearFacebookCookies(Context context)
final static Unitlogd(String tag, Exception e)
final static Unitlogd(String tag, String msg)
final static Unitlogd(String tag, String msg, Throwable t)
final static <T extends Any> BooleanareObjectsEqual(T a, T b)
final static StringsafeGetStringFromResponse(JSONObject response, String propertyName)
final static JSONObjecttryGetJSONObjectFromResponse(JSONObject response, String propertyKey)
final static JSONArraytryGetJSONArrayFromResponse(JSONObject response, String propertyKey)
final static List<String>jsonArrayToStringList(JSONArray jsonArray)
final static Set<String>jsonArrayToSet(JSONArray jsonArray)
final static StringmapToJsonStr(Map<String, String> map)
final static Map<String, String>jsonStrToMap(String str)
final static UnitsetAppEventAttributionParameters(JSONObject params, AttributionIdentifiers attributionIdentifiers, String anonymousAppDeviceGUID, Boolean limitEventUsage, Context context)
final static StringgetAppVersion() Get the app version of the app, as specified by the manifest.
final static UnitsetAppEventExtendedDeviceInfoParameters(JSONObject params, Context appContext)
final static MethodgetMethodQuietly(Class<?> clazz, String methodName, Class<?> parameterTypes)
final static MethodgetMethodQuietly(String className, String methodName, Class<?> parameterTypes)
final static ObjectinvokeMethodQuietly(Object receiver, Method method, Object args)
final static StringgetActivityName(Context context) Returns the name of the current activity if the context is an activity, otherwise return "unknown"
final static StringgetUriString(Uri uri)
final static BooleanisWebUri(Uri uri)
final static BooleanisContentUri(Uri uri)
final static BooleanisFileUri(Uri uri)
final static LonggetContentSize(Uri contentUri)
final static DategetBundleLongAsDate(Bundle bundle, String key, Date dateBase)
final static UnitwriteStringMapToParcel(Parcel parcel, Map<String, String> map)
final static Map<String, String>readStringMapFromParcel(Parcel parcel)
final static UnitwriteNonnullStringMapToParcel(Parcel parcel, Map<String, String> map)
final static Map<String, String>readNonnullStringMapFromParcel(Parcel parcel)
final static BooleanisCurrentAccessToken(AccessToken token)
final static StringgetGraphDomainFromTokenDomain(String tokenGraphDomain)
final static UnitgetGraphMeRequestWithCacheAsync(String accessToken, Utility.GraphMeRequestWithCacheCallback callback)
final static JSONObjectawaitGetGraphMeRequestWithCache(String accessToken)
final static StringgenerateRandomString(Integer length)
final static BooleanmustFixWindowParamsForAutofill(Context context)
final static BooleanisAutofillAvailable(Context context)
final static BooleanisChromeOS(Context context) Determines whether the application is running on Chrome OS or not
final static UnitrunOnNonUiThread(Runnable runnable)
final static StringgetAppName(Context context)
final StringgetLOG_TAG()
final IntegergetDEFAULT_STREAM_BUFFER_SIZE()
final static LocalegetResourceLocale()
final static LocalegetCurrentLocale()
final static BooleangetIsAutoAppLinkSetup()
final static JSONObjectgetDataProcessingOptions()
final static BooleangetIsDataProcessingRestricted()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Method Detail

isNullOrEmpty

 final static BooleanisNullOrEmpty(Collection<?> c)

isNullOrEmpty

 final static BooleanisNullOrEmpty(String s)

coerceValueIfNullOrEmpty

 final static StringcoerceValueIfNullOrEmpty(String s, String valueIfNullOrEmpty)
Use this when you want to normalize empty and null strings This way, Utility.areObjectsEqual can used for comparison, where a null string is to be treated the same as an empty string.
Parameters:
s - The string to coerce
valueIfNullOrEmpty - The value if s is null or empty.

md5hash

 final static Stringmd5hash(String key)

sha1hash

 final static Stringsha1hash(String key)

sha1hash

 final static Stringsha1hash(ByteArray bytes)

sha256hash

 final static Stringsha256hash(String key)

sha256hash

 final static Stringsha256hash(ByteArray bytes)

buildUri

 final static UribuildUri(String authority, String path, Bundle parameters)

parseUrlQueryString

 final static BundleparseUrlQueryString(String queryString)

putNonEmptyString

 final static UnitputNonEmptyString(Bundle b, String key, String value)

putCommaSeparatedStringList

 final static UnitputCommaSeparatedStringList(Bundle b, String key, List<String> list)

putUri

 final static UnitputUri(Bundle b, String key, Uri uri)

putJSONValueInBundle

 final static BooleanputJSONValueInBundle(Bundle bundle, String key, Object value)

closeQuietly

 final static UnitcloseQuietly(Closeable closeable)

disconnectQuietly

 final static UnitdisconnectQuietly(URLConnection connection)

getMetadataApplicationId

 final static StringgetMetadataApplicationId(Context context)

convertJSONObjectToHashMap

 final static Map<String, Object> convertJSONObjectToHashMap(JSONObject jsonObject)

convertJSONObjectToStringMap

 final static Map<String, String> convertJSONObjectToStringMap(JSONObject jsonObject)

convertJSONArrayToList

 final static List<String> convertJSONArrayToList(JSONArray jsonArray)

getStringPropertyAsJSON

 final static ObjectgetStringPropertyAsJSON(JSONObject jsonObject, String key, String nonJSONPropertyKey)

readStreamToString

 final static StringreadStreamToString(InputStream inputStream)

copyAndCloseInputStream

 final static IntegercopyAndCloseInputStream(InputStream inputStream, OutputStream outputStream)

stringsEqualOrEmpty

 final static BooleanstringsEqualOrEmpty(String a, String b)

clearFacebookCookies

 final static UnitclearFacebookCookies(Context context)

logd

 final static Unitlogd(String tag, Exception e)

logd

 final static Unitlogd(String tag, String msg)

logd

 final static Unitlogd(String tag, String msg, Throwable t)

areObjectsEqual

 final static <T extends Any> BooleanareObjectsEqual(T a, T b)

safeGetStringFromResponse

 final static StringsafeGetStringFromResponse(JSONObject response, String propertyName)

tryGetJSONObjectFromResponse

 final static JSONObjecttryGetJSONObjectFromResponse(JSONObject response, String propertyKey)

tryGetJSONArrayFromResponse

 final static JSONArraytryGetJSONArrayFromResponse(JSONObject response, String propertyKey)

jsonArrayToStringList

 final static List<String> jsonArrayToStringList(JSONArray jsonArray)

jsonArrayToSet

 final static Set<String> jsonArrayToSet(JSONArray jsonArray)

mapToJsonStr

 final static StringmapToJsonStr(Map<String, String> map)

jsonStrToMap

 final static Map<String, String> jsonStrToMap(String str)

setAppEventAttributionParameters

 final static UnitsetAppEventAttributionParameters(JSONObject params, AttributionIdentifiers attributionIdentifiers, String anonymousAppDeviceGUID, Boolean limitEventUsage, Context context)

getAppVersion

 final static StringgetAppVersion()
Get the app version of the app, as specified by the manifest.
Note that the function should be called after FacebookSdk is initialized. Otherwise, exception FacebookSdkNotInitializedException will be thrown.

setAppEventExtendedDeviceInfoParameters

 final static UnitsetAppEventExtendedDeviceInfoParameters(JSONObject params, Context appContext)

getMethodQuietly

 final static MethodgetMethodQuietly(Class<?> clazz, String methodName, Class<?> parameterTypes)

getMethodQuietly

 final static MethodgetMethodQuietly(String className, String methodName, Class<?> parameterTypes)

invokeMethodQuietly

 final static ObjectinvokeMethodQuietly(Object receiver, Method method, Object args)

getActivityName

 final static StringgetActivityName(Context context)
Returns the name of the current activity if the context is an activity, otherwise return "unknown"

getUriString

 final static StringgetUriString(Uri uri)

isWebUri

 final static BooleanisWebUri(Uri uri)

isContentUri

 final static BooleanisContentUri(Uri uri)

isFileUri

 final static BooleanisFileUri(Uri uri)

getContentSize

 final static LonggetContentSize(Uri contentUri)

getBundleLongAsDate

 final static DategetBundleLongAsDate(Bundle bundle, String key, Date dateBase)

writeStringMapToParcel

 final static UnitwriteStringMapToParcel(Parcel parcel, Map<String, String> map)

readStringMapFromParcel

 final static Map<String, String> readStringMapFromParcel(Parcel parcel)

writeNonnullStringMapToParcel

 final static UnitwriteNonnullStringMapToParcel(Parcel parcel, Map<String, String> map)

readNonnullStringMapFromParcel

 final static Map<String, String> readNonnullStringMapFromParcel(Parcel parcel)

isCurrentAccessToken

 final static BooleanisCurrentAccessToken(AccessToken token)

getGraphDomainFromTokenDomain

 final static StringgetGraphDomainFromTokenDomain(String tokenGraphDomain)

getGraphMeRequestWithCacheAsync

 final static UnitgetGraphMeRequestWithCacheAsync(String accessToken, Utility.GraphMeRequestWithCacheCallback callback)

awaitGetGraphMeRequestWithCache

 final static JSONObjectawaitGetGraphMeRequestWithCache(String accessToken)

generateRandomString

 final static StringgenerateRandomString(Integer length)

mustFixWindowParamsForAutofill

 final static BooleanmustFixWindowParamsForAutofill(Context context)

isAutofillAvailable

 final static BooleanisAutofillAvailable(Context context)

isChromeOS

 final static BooleanisChromeOS(Context context)
Determines whether the application is running on Chrome OS or not
Parameters:
context - the Context

runOnNonUiThread

 final static UnitrunOnNonUiThread(Runnable runnable)

getAppName

 final static StringgetAppName(Context context)

getLOG_TAG

 final StringgetLOG_TAG()

getDEFAULT_STREAM_BUFFER_SIZE

 final IntegergetDEFAULT_STREAM_BUFFER_SIZE()

getResourceLocale

 final static LocalegetResourceLocale()

getCurrentLocale

 final static LocalegetCurrentLocale()

getIsAutoAppLinkSetup

 final static BooleangetIsAutoAppLinkSetup()

getDataProcessingOptions

 final static JSONObjectgetDataProcessingOptions()

getIsDataProcessingRestricted

 final static BooleangetIsDataProcessingRestricted()