The Fileprovider of Android development

Source: Internet
Author: User

When you are doing your project recently, you need to use Fileprovider. Therefore, the following studies are summarized as follows:

Official path: http://developer.android.com/intl/zh-cn/training/secure-file-sharing/setup-sharing.html

    • such as SMS to share a picture to Bluetooth, need to do is set in the text message is as follows:

First, you need to add a provider tag to the Menifest:

1 <!--define the shared information here -  2         <provider3             Android:name= "Android.support.v4.content.FileProvider"  4 android:authorities= "Com.example.fileproviderdemo.fileprovider"  5 android:exported= "false"  6 android:granturipermissions= "true" >  7             <Meta-data8                 Android:name= "Android.support.FILE_PROVIDER_PATHS"  9 Android:resource= "@xml/filepaths" />  Ten         </provider> 

Then, specify the shared directory and create a new Filepaths.xml file in the Res directory XML

1 <?XML version= "1.0" encoding= "Utf-8"?>  2 <Resources>  3     <Paths>  4       <Files-pathPath= "files/"name= "Intfiles" />  5       <External-pathPath= "files/"name= "Extfiles" />  6     </Paths>  7 </Resources>  

It's better to write a demo sometime.

Android Development Fileprovider

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.