Facebook でいくつかのものを共有するには、FacebookSdk 3.0 を実装する必要があります。このチュートリアルに従ってください:
http://www.kpbird.com/2013/03/android-login-using-facebook-sdk-30.html
主な目標は、facebook を介して「ログイン」を提供し、壁で何かを共有することです。ログインが機能したら、次の方法を試してください。
private void publishStory(String hash, String title, String user) {
Session session = Session.getActiveSession();
if (session != null){
// Check for publish permissions
List<String> permissions = session.getPermissions();
if (!isSubsetOf(PERMISSIONS, permissions)) {
pendingPublishReauthorization = true;
Session.NewPermissionsRequest newPermissionsRequest = new Session
.NewPermissionsRequest(getActivity(), PERMISSIONS);
session.requestNewPublishPermissions(newPermissionsRequest);
return;
}
Bundle postParams = new Bundle();
postParams.putString("name", title);
postParams.putString("caption", "By Recommend Android");
postParams.putString("description", user+" "+"STRONGLY recommends"+" "+title);
postParams.putString("link", "http://re.co/"+hash);
postParams.putString("picture", "http://re.co/assets/img/useful-exp.png");
Request.Callback callback= new Request.Callback() {
public void onCompleted(Response response) {
JSONObject graphResponse = response
.getGraphObject()
.getInnerJSONObject();
String postId = null;
try {
postId = graphResponse.getString("id");
} catch (JSONException e) {
Log.i(TAG,
"JSON error "+ e.getMessage());
}
次のように、strings.xml で Html タグを宣言する必要があることを忘れないでください。
<string name="demoStr"><Data><![CDATA[ <b>ABC</b><br /> something ]]> </Data></string>
次に getString() が取得されます"<b>ABC</b><br />something"