3

我正在实现以下代码以在 Instagram 上共享图像和文本:

public void ShareInstagram() {
        Log.e("SHARE", "IN INSTAGRAM");
        Intent intent = getActivity().getPackageManager()
                .getLaunchIntentForPackage("com.instagram.android");
        if (intent != null) {
            String type = "image/*";
            Intent share = new Intent(Intent.ACTION_SEND);
            share.setType(type);

            share.putExtra(Intent.EXTRA_STREAM, file);
            share.putExtra(Intent.EXTRA_TEXT, SHARE_NAME);
            share.setPackage("com.instagram.android");
            share.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            // Broadcast the Intent.
            startActivity(share);
        } else {
            Intent inplay = new Intent(Intent.ACTION_VIEW);
            inplay.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            inplay.setData(Uri.parse("market://details?id="
                    + "com.instagram.android"));
            startActivity(inplay);
        }

    }

当我在 instagram 中从我的应用程序共享并且我没有登录 instagram 时,它会打开 instagram 应用程序的登录或注册屏幕并显示必须登录才能共享的 toast 消息。之后,当我按下后退按钮时,我将转移到我的应用程序并恢复共享活动。但我无法访问任何屏幕控制。如果我再次按下,那么只有我可以访问它。

仅当我未登录 instagram 应用程序时才会出现此问题。帮助我找到正确的解决方案。

4

1 回答 1

-1

我也注意到了这个问题。好像是instagram版本的问题。我用的是旧的。更新到最新版本后,此问题已解决。

于 2015-04-22T09:28:02.857 回答