public static void openShareDialog(Context context,String title,@SuppressWarnings("SameParameterValue") String uri,String shareText,String shareSubject){
  Intent share=new Intent(Intent.ACTION_SEND);
  share.setType("text/plain");
  share.putExtra(Intent.EXTRA_TEXT,shareText);
  share.putExtra(Intent.EXTRA_SUBJECT,shareSubject);
  if (!TextUtils.isEmpty(uri)) {
    share.setType("image/*");
    share.putExtra(Intent.EXTRA_STREAM,Uri.parse(uri));
  }
  context.startActivity(Intent.createChooser(share,title));
}

public static void openShareDialog ( Context context , String title , @ SuppressWarnings ( "SameParameterValue" ) String uri , String shareText , String shareSubject ) { Intent share = new Intent ( Intent . ACTION_SEND ) ; share . setType ( "text/plain" ) ; share . putExtra ( Intent . EXTRA_TEXT , shareText ) ; share . putExtra ( Intent . EXTRA_SUBJECT , shareSubject ) ; if ( ! TextUtils . isEmpty ( uri ) ) { share . setType ( "image/*" ) ; share . putExtra ( Intent . EXTRA_STREAM , Uri . parse ( uri ) ) ; } context . startActivity ( Intent . createChooser ( share , title ) ) ; }
opens android share dialog pass one of uri or sharetext
