Ниже приведен код;
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("image/*");
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + finalFile.getAbsolutePath()));
shareIntent.setPackage("com.instagram.android");
startActivityForResult(Intent.createChooser(shareIntent, "Share your Photo"),INSTA);
и ниже onActivityResult
не работает;
if (requestCode==INSTA)
{
if (resultCode == Activity.RESULT_OK) {
// Here you do what you have to do.
Toast.makeText(getApplicationContext(),"share successful...",Toast.LENGTH_LONG).show();
}else
{
Toast.makeText(getApplicationContext(),"share unsuccessful...",Toast.LENGTH_LONG).show();
}
}