Sharing a png image in drawable folder

前端 未结 5 1725
野趣味
野趣味 2020-11-27 19:02

I am integrating share with the following code for the app.

private void socialShare()
    {
        Uri uri = Uri.parse(\"android.resource://com.example.myp         


        
5条回答
  •  温柔的废话
    2020-11-27 19:19

    You can share using the following method...

    Intent shareIntent = new Intent();
    shareIntent.setAction(Intent.ACTION_SEND);
    shareIntent.setType("image/png");
    Uri uri = Uri.parse("android.resource://your package name/"+R.drawable.ic_launcher);
    shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
    shareIntent.putExtra(Intent.EXTRA_TEXT, "Hello, This is test Sharing");
    startActivity(Intent.createChooser(shareIntent, "Send your image"));
    

    Tried and tested...working for me

提交回复
热议问题