• About
  • Advertise
  • Privacy & Policy
  • Contact
Tech News, Magazine & Review WordPress Theme 2017
  • Home
    • Home – Layout 1
    • Home – Layout 2
    • Home – Layout 3
    • Home – Layout 4
    • Home – Layout 5
  • Review
  • Gaming
  • Gear

    Trending Tags

    • Best iPhone 7 deals
    • Apple Watch 2
    • Nintendo Switch
    • CES 2017
    • Playstation 4 Pro
    • iOS 10
    • iPhone 7
    • Sillicon Valley
  • Computers
  • Applications
  • Security
No Result
View All Result
  • Home
    • Home – Layout 1
    • Home – Layout 2
    • Home – Layout 3
    • Home – Layout 4
    • Home – Layout 5
  • Review
  • Gaming
  • Gear

    Trending Tags

    • Best iPhone 7 deals
    • Apple Watch 2
    • Nintendo Switch
    • CES 2017
    • Playstation 4 Pro
    • iOS 10
    • iPhone 7
    • Sillicon Valley
  • Computers
  • Applications
  • Security
No Result
View All Result
Overflow Archives
No Result
View All Result

Sharing files in Android using Intents – Share Content Using Intent – Android Tutorial

by
Home Android
Share on FacebookShare on Twitter

In this post, we will learn how to share the files in Android using the Intent. Android allows us to share the content with intent, this can be done by using Implicit intent. It uses the action ACTION_SEND, it will communicate with other applications to share the content using the URI of the files.

Before proceed, what is intent in Android?

Intent – in Android Intent is a message object that is used to communicate between different components, like Activities, Broadcast receiver, Content Providers, and Services.

There are two types of intent available in Android, one is Implicit Intent and another one is Explicit Intent. The first one ‘Implicit Intent’ doesn’t specify the component but it provides the information of available components provided by the system that is best to run for that.
The Explicit Intent is the one that runs the specific component or the class, it is mostly used to run the different internal activities.

How to share the files in Android

To share the files in Android we have to do the following steps.
First set the permission in the AndroidManifest file, as followed. Also, you need to add a permission request handler to get storage access for the application. You can find the article for creating a Permission handler for storage and other types.

Create the file path for your Android application, in res->xmlfolder. Please include the paths you want to access, here I have included all the file paths for a typical application.

The above lines will tell the available paths to the application, you can add/remove them as you need. I have added all possible file paths in this code.

Now set up the provider in the AndroidManifest file as below. Add these lines inside the activity blocks.

The Manifest file setup is done, let’s implement the sharing intent handling in your Activity or the Fragment. Do the following in your project.

First create a file from the path which have to be shared, then get the content URI of the file using FileProvider. Check for the availability of the Content for null. If the content URI is valid then invoke Share intent bythe following method.

Output

While calling the share method as mentioned above you will see a file-sharing chooser. This will list the available applications for sharing the given mime-type .

Similarly, you can use the same way to share different content with external applications. Happy Coding!

Tags: androidandroid codeandroid developmentandroid file sharing tutorialandroid intentfile sharingfile sharing in androidfile sharing tutorial androidhow to share files in androidshare file using intent in androidsharing content with intent

Next Post
How To Parse The JSON File In Unity 3D  C# – Unity 3D Tutorial

How To Parse The JSON File In Unity 3D C# - Unity 3D Tutorial

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recommended.

How To Parse The JSON File In Unity 3D  C# – Unity 3D Tutorial

How To Parse The JSON File In Unity 3D C# – Unity 3D Tutorial

overflowarchives.com - Android gradle SHA key

How to generate Android studio SHA key

Trending.

How to Create circular progress bar in Unity 3D with rounded edge

Progress bar in Unity 3D

How to Create Progress bar in Unity 3D

Unity Gradient Effect UI Design Without Scripting | Simple Gradient Effects in Unity 3D

Unity Gradient Effect UI Design Without Scripting | Simple Gradient Effects in Unity 3D

Parse Color Runtime In Unity 3D - Thumbnail

Change Color in Runtime – Unity 3D Tutorial

Create Switch button UI in Unity 3D - overflow archives

Create Switch button UI in Unity 3D

Overflow Archives

© 2023 OverflowArchives.

Navigate Site

  • About
  • Advertise
  • Privacy & Policy
  • Contact

Follow Us

No Result
View All Result
  • Home
  • Review
  • Apple
  • Applications
  • Computers
  • Gaming
  • Gear
    • Audio
    • Camera
    • Smartphone
  • Microsoft
  • Photography
  • Security

© 2023 OverflowArchives.