share-intent

Share audio file from the res/raw folder thorugh Share Intent in Android

為{幸葍}努か 提交于 2021-01-28 04:53:10
问题 I'm trying to share an audio file from my res/raw folder. What I've done so far is: Uri uri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.sound); //parse path to uri Intent share = new Intent(Intent.ACTION_SEND); //share intent share.setType("audio/*"); share.putExtra(Intent.EXTRA_STREAM, uri); startActivity(Intent.createChooser(share, "Share sound to")); When I choose to share it on GMail, for example, it says something like "Failed to attach empty file". Looks like I'm

share intent text in android studio using kotlin

痞子三分冷 提交于 2020-01-10 20:00:30
问题 I want to share text in my CardView using share Intent using kotlin but there is a problem with last line in the code in kotlin the code val shareIntent = Intent() shareIntent.action = Intent.ACTION_SEND shareIntent.putExtra(Intent.EXTRA_STREAM, "ali") shareIntent.type = "text/plain" startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.send_to))) here is the problem in the code startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.send_to))

Rename URI file to share audio from raw folder

谁说我不能喝 提交于 2020-01-06 06:38:43
问题 I'm trying to make an application with sharing of children that are inside the "raw" folder of the application, but I'm not getting it. The file is shared but does not have an .mp3 extension. I was not able to hear Windows Media Player, but I put a .mp3 extension manually. Does anybody have any idea how I do it to get .mp3 extension automatically? Transform / rename a URI into mp3 file. The name of the song comes as it is registered in the file, I believe that if it was possible to rename

Make title text bold when sharing

独自空忆成欢 提交于 2020-01-05 00:44:27
问题 Here, the code below will share the content onclick. While sharing the content through other app there are two contents: one is ti - title, another is de - description. I want to make the title bold while sharing. Is that possible? expListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { // TODO Auto-generated method stub TextView de = (TextView)

How to share current app's APK (or of other installed apps) using the new FileProvider?

♀尐吖头ヾ 提交于 2019-12-29 08:07:51
问题 Background In the past, it was easy to share an APK file with any app you wanted, using a simple command: startActivity(new Intent(Intent.ACTION_SEND,Uri.fromFile(filePath)).setType("*/*")); The problem If your app targets Android API 24 (Android Nougat) or above, the above code will cause a crash, caused by FileUriExposedException (written about it here, and an example solution for opening an APK file can be found here) . This actually worked for me fine, using below code: File apkFile = new

Intent.ACTION_SEND not working on Oreo [duplicate]

时间秒杀一切 提交于 2019-12-29 00:49:07
问题 This question already has answers here : android.os.FileUriExposedException: file:///storage/emulated/0/test.txt exposed beyond app through Intent.getData() (24 answers) Closed last year . I am developing a custom camera application which captures a picture and stores it in the gallery. When I share that image using Intent.ACTION_SEND, it works absolutely fine on all devices except for devices having API 26, i.e. OREO. My code to share the image is: Intent shareIntent = new Intent();

Share image and text through Whatsapp or Facebook

我怕爱的太早我们不能终老 提交于 2019-12-17 04:22:41
问题 I have in my app a share button and i want to share an image and a text at the same time. In GMail it works fine but in WhatsApp, only the image is sent and in Facebook the app crashes. The code i use to share is this: Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("image/*"); shareIntent.putExtra(Intent.EXTRA_TEXT, "Message"); Uri uri = Uri.parse("android.resource://" + getPackageName() + "/drawable/ford_focus_2014"); try { InputStream stream = getContentResolver()

Share image and text through Whatsapp or Facebook

前提是你 提交于 2019-12-17 04:22:36
问题 I have in my app a share button and i want to share an image and a text at the same time. In GMail it works fine but in WhatsApp, only the image is sent and in Facebook the app crashes. The code i use to share is this: Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("image/*"); shareIntent.putExtra(Intent.EXTRA_TEXT, "Message"); Uri uri = Uri.parse("android.resource://" + getPackageName() + "/drawable/ford_focus_2014"); try { InputStream stream = getContentResolver()

Intent share not working with image and text sharing

杀马特。学长 韩版系。学妹 提交于 2019-12-13 22:38:59
问题 I am using share intent in my application,but i am not able to share image and text,i am using image and text from my json response,but it is not working.i am not getting any error,but the the method for sharing is not working JSON Response : http://pastie.org/10753346 public void onShareItem(View v) { // Get access to bitmap image from view // Get access to the URI for the bitmap Uri bmpUri = getLocalBitmapUri(descpic); if (bmpUri != null) { // Construct a ShareIntent with link to image

Android button crashes

我的未来我决定 提交于 2019-12-11 23:15:44
问题 I have developed a actionbar share button, however when I run the app the button does work but it crashes the application when I try to share the images with other apps. For example if I share the image with Twitter or message the application just crashes and says that "Twitter or Message has crashed. 回答1: EXTRA_STREAM is supposed to hold a content: Uri. In practice, you can often use a file: Uri pointing to a file on external storage, though that will be a problem more and more as time goes