我想在Facebook的Messenger应用程序上分享一个字符串消息,但我找不到可行的解决方案吗?有人可以帮我这么做吗?现在我有这个代码,它不起作用:
String mimeType = "text/*";
Uri contentUri = Uri.parse(getString(R.string.share_msg));
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setPackage("com.facebook.orca");
intent.setType(mimeType);
intent.putExtra(Intent.EXTRA_STREAM, contentUri);
intent.putExtra(EXTRA_PROTOCOL_VERSION, PROTOCOL_VERSION);
intent.putExtra(EXTRA_APP_ID, getString(R.string.share_msg));
startActivityForResult(intent, SHARE_TO_MESSENGER_REQUEST_CODE);
当我运行此代码时,Facebook信使崩溃了这个日志:
Handling exception for crash
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.facebook.orca/com.facebook.messaging.sharing.ShareLauncherActivity}: java.lang.NullPointerException
有谁知道可以将文本内容分享给facebook Messenger,我该怎么做?