please help! I want share my photo into Instagram. I use Intent for sharing, but I don't need at all list in Share, such as - Facebook, Instagram, Gmail, Bluetoth... etc. I need only Instagram. I want share photo into Instagram by only onclickListener. How can do it? thanks.
2 Answers
It is asked a long time ago. But the clear answer is not here. That's why, I want to answer as well.
I have been used that code below and it worked. It redirects to crop screen of instagram directly. (Of course, Instagram app must be installed on the device.)
...
Intent intent = createInstagramIntent("file://" + filePath);
startActivity(intent);
...
and
private Intent createInstagramIntent(String uriString) {
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("image/*");
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(uriString));
shareIntent.setPackage("com.instagram.android");
return shareIntent;
}
-
Maybe add checks if instagram is installed? (by PackageManager) otherwise it may crash.– TalhaCommented Nov 26, 2016 at 12:47
-
But after the Sharing is done, will the Instagram app redirect the user back to our App? Commented May 30, 2018 at 6:41
Create your custom sharing screen that call instagram.
-
Please show me sample code, how can call package of instagram, because I don't found this. I do like this:
Intent i = new Intent(Intent.ACTION_SEND); i.setType("image/jpeg"); i.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/Path/To/Image.jpg")); startActivity(Intent.createChooser(i, "Share Image"));
– LjudmilaCommented Nov 2, 2012 at 6:37 -
1Create dialog view with instagram button. See this article:megadarja.blogspot.com/2011/10/appchooser.html– Yahor10Commented Nov 2, 2012 at 7:01
-
But I don't need dialog with choose. I need by click on ImageButton post Image to app insragram– LjudmilaCommented Nov 2, 2012 at 7:06
-
send intent with package name of instagram application(com.instagram.android). See this post how do it stackoverflow.com/questions/2780102/…– Yahor10Commented Nov 2, 2012 at 7:42
-
1see your the package name of your instagramm app from package manager.Have you install intagram app to your phone?– Yahor10Commented Nov 2, 2012 at 8:04
Intent i = new Intent(Intent.ACTION_SEND); i.setType("image/jpeg"); i.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/Path/To/Image.jpg")); startActivity(Intent.createChooser(i, "Share Image"));