如何在Facebook墙上显示默认文字?

时间:2012-11-20 04:15:13

标签: android facebook android-intent

我正在开发一个应用程序。在其中,我显示所有默认共享选项,如Bluetooth, E-Mail, Drive, Facebook, Twitter, Yahoo, FreeSMS。我在All except Facebook中获得默认文字。如何在Facebook墙上设置默认文本。请帮助我解决这个问题。

我的代码如下:

public class MainActivity extends Activity implements OnClickListener {

private Button btn_share;
// private Dialog mdialog = null;
private String TAG = "This Message is from HardenUp.Thank You.";

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_main);

    getInit();
}

private void getInit() {
    btn_share = (Button) findViewById(R.id.btn_share);
    btn_share.setOnClickListener(this);
}

public void onClick(View v) {
    if (v == btn_share) {
        // showDialog();

        Intent sharingIntent = new Intent(
                android.content.Intent.ACTION_SEND);

        sharingIntent.setType("text/plain");
        sharingIntent.putExtra(Intent.EXTRA_TEXT, TAG);
        sharingIntent.putExtra(Intent.EXTRA_SUBJECT, "HardenUp");
        startActivity(Intent.createChooser(sharingIntent, "Share Using"));
    }

}

}

1 个答案:

答案 0 :(得分:0)

public void postOnWall(String msg) {
        Log.d("Tests", "Testing graph API wall post");
         try {
                String response = mFacebook.request("me");
                Bundle parameters = new Bundle();
                //Here what you want to pass message
                parameters.putString("message", msg);
                //Here what you want to pass message
                parameters.putString("description", "test test test");
                response = mFacebook.request("me/feed", parameters, 
                        "POST");
                Log.d("Tests", "got response: " + response);
                if (response == null || response.equals("") || 
                        response.equals("false")) {
                   Log.v("Error", "Blank response");
                }
         } catch(Exception e) {
             e.printStackTrace();
         }
    }