Reputation: 79
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.
Upvotes: 2
Views: 14526
Reputation: 4267
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;
}
Upvotes: 9