Util
لم تعد هذه الفئة متوفر في أحدث إصدار من SDK.
يتوفر إصدار أحدث لهذه الفئة. يرجى التحقق أحدث إصدار.

Utility class supporting the Facebook Object.

THIS CLASS SHOULD BE CONSIDERED DEPRECATED.

All public members of this class are intentionally deprecated. New code should instead use Request

Adding @Deprecated to this class causes warnings in other deprecated classes that reference this one. That is the only reason this entire class is not deprecated.

الإضافات:Object
الحزمة:android
أدوات الإنشاء
Util()
public Util()
طرق الفئات
encodePostBody(Bundle, String)

Generate the multi-part post body providing the parameters and boundary string

public static String encodePostBody(Bundle parameters, String boundary)
المعلمةالوصف
parametersThe parameters need to be posted
boundaryThe random string as boundary
Returns
A string of the post body
encodeUrl(Bundle)
public static String encodeUrl(Bundle parameters)
المعلمةالوصف
parameters
decodeUrl(String)
public static Bundle decodeUrl(String s)
المعلمةالوصف
s
parseUrl(String)

Parse a URL query and fragment parameters into a key-value bundle.

public static Bundle parseUrl(String url)
المعلمةالوصف
urlThe URL to parse
Returns
A dictionary bundle of keys and values
openUrl(String, String, Bundle)

Connect to an HTTP URL and return the response as a string.

Note that the HTTP method override is used on non-GET requests. (i.e. requests are made as "POST" with method specified in the body).

public static String openUrl(String url, String method, Bundle params)
المعلمةالوصف
url- the resource to open: must be a welformed URL
method- the HTTP method to use ("GET", "POST", etc.)
params- the query parameter for the URL (e.g. access_token=foo)
Returns
The URL contents as a String
parseJson(String)

Parse a server response into a JSON Object. This is a basic implementation using org.json.JSONObject representation. More sophisticated applications may wish to do their own parsing.

The parsed JSON is checked for a variety of error fields and a FacebookException is thrown if an error condition is set, populated with the error message and error type or code if available.

public static JSONObject parseJson(String response)
المعلمةالوصف
response- string representation of the response
Returns
The response as a JSON Object
showAlert(Context, String, String)

Display a simple alert dialog with the given text and title.

public static void showAlert(Context context, String title, String text)
المعلمةالوصف
contextAndroid context in which the dialog should be displayed
titleAlert dialog title
textAlert dialog message