问题描述
我正在深化发展的应用程序,我想分享的Instagram照片。
i'm developping an app and i'm trying to share a picture in Instagram .
我使用下面的code:
i'm using the code below :
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("image/jpeg");
i.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///"+savedPhotoPath));//savedPhotoPath is the path of my picture stored somewhere in the sdcard
startActivity(Intent.createChooser(i, "Share Image"));
的问题是,instagramm是与归属活动推出,(我想有共享的该图像被发射的活动)。
the problem is that the instagramm is launched with the home activity,( i want to have the activity of share that picture to be launched ).
我试图把临时演员是这样的:
i've tried to put the extras like this :
i.putExtra(Intent.EXTRA_STREAM, new File(savedPhotoPath));
和
i.putExtra(Intent.EXTRA_STREAM, Uri.parse(savedPhotoPath));
具有相同的结果,总是对Instagram的应用的主场活性启动
with the same result , always , the home activity of instagram application is launched .
任何想法如何解决这个问题?
any ideas how to solve this problem?
问候,
推荐答案
这只是一个愚蠢的错误我做了,我已经加在斜线文件:///
路径,它将Concat的与savedPhotoPath,将成为4斜线,所以把临时演员正确的做法是:
it's just a stupid error i've made, i've added a slash on the file:///
path , and it will concat with savedPhotoPath and it will become 4 slashes , so the correct way to put extras is :
i.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+savedPhotoPath));// it will give : file:///sdcard/...
这篇关于分享Instagram的照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!