Hello. I decided to study sharing in social networks, and started with a simple, through the applications of social networks themselves. I found an article about sharing, and there was a code. I tried to apply it in relation to my application, and when choosing from the list through what to fumble (I selected VK) I received the message "Sending this file is not supported." The file in jpg format is in the drawable folder. Please tell me how to write correctly.

Uri uri = Uri.parse("android.resource://"+getPackageName()+"/drawable/w_01_r_01"); final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("image/jpg"); intent.putExtra(Intent.EXTRA_SUBJECT, uri); startActivity(Intent.createChooser(intent, getString(R.string.app_name))); 

    1 answer 1

    Try a different way to set the resource URI:

     Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://"+getPackageName()+"/"+R.drawable.w_01_r_01);