相关疑难解决方法(0)

Android和Facebook分享意图

我正在开发一个Android应用程序,我很想知道如何使用Android的共享意图从应用程序内更新应用程序用户的状态.

通过浏览Facebook的SDK看起来这很容易做到,但是我很想让用户通过常规的Share Intent弹出窗口来完成它吗?看到这里:

弹出

我尝试过通常的共享意图代码,但这似乎不适用于Facebook.

public void invokeShare(Activity activity, String quote, String credit) {
    Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
    shareIntent.setType("text/plain");
    shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, activity.getString(R.string.share_subject));
    shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Example text");    

    activity.startActivity(Intent.createChooser(shareIntent, activity.getString(R.string.share_title)));
}
Run Code Online (Sandbox Code Playgroud)

更新:进行了更多的挖掘,看起来这是Facebook的应用程序的一个错误尚未解决!(facebook bug)对于平均时间,看起来我只能忍受负面的"分享不起作用!!!" 评论.干杯Facebook:*(

android facebook android-intent

81
推荐指数
4
解决办法
13万
查看次数

通过Whatsapp或Facebook分享图像和文字

我在我的应用程序中有一个共享按钮,我想同时共享图像和文本.Gmail中工作正常,但在WhatsApp的,只有图像被发送和Facebook的应用程序崩溃.

我使用共享代码是这样的:

Intent shareIntent = new Intent(Intent.ACTION_SEND);  
shareIntent.setType("image/*");
shareIntent.putExtra(Intent.EXTRA_TEXT, "Message");         

Uri uri = Uri.parse("android.resource://" + getPackageName() + "/drawable/ford_focus_2014");
     try {
        InputStream stream = getContentResolver().openInputStream(uri);
    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
Run Code Online (Sandbox Code Playgroud)

如果我使用"shareIntent.setType("*/*")"Facebook和WhatsApp崩溃.

有办法做到这一点吗?也许同时发送两条消息(WhatsApp).

提前致谢.

android facebook whatsapp share-intent

24
推荐指数
3
解决办法
6万
查看次数

启动"com.twitter.android.PostActivity"时出错

我呼吁Twitter分享文本.无需更改代码,从一天到另一天,此调用已停止工作.

意图是:

Intent share = new Intent(Intent.ACTION_VIEW);
    share.setClassName("com.twitter.android",
            "com.twitter.android.PostActivity");
    share.setType("text/plain");

    share.putExtra(Intent.EXTRA_TEXT, getString(R.string.app_share_twitter));

    share.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    startActivityForResult(share, SHARE_TWITTER);
Run Code Online (Sandbox Code Playgroud)

谢谢

twitter android share

4
推荐指数
2
解决办法
1868
查看次数