java - How can I handle file uploading to other apps and sites? Android -


i working on simple android file manager. problem facing getting app upload files app or site when wants send files , such. tried reading through developer docs, bit confusing. how can set mainactivity(if place put this) handle , allow uploading of files? here have in manifest...

<activity android:name="com.myapp.mainactivity" android:label="@string/app_name"                   android:configchanges="keyboardhidden|screensize|orientation">             <intent-filter>                 <action android:name="android.intent.action.main"/>                 <category android:name="android.intent.category.launcher"/>             </intent-filter>             <intent-filter>                 <action android:name="android.intent.action.get_content"/>                 <category android:name="android.intent.category.openable"/>                 <category android:name="android.intent.category.default"/>                 <data android:mimetype="*/*"/>             </intent-filter>             <intent-filter>                 <action android:name="android.intent.action.pick"/>                 <category android:name="android.intent.category.default"/>                 <category android:name="android.intent.category.browsable"/>                 <data android:scheme="file"/>                 <data android:scheme="folder"/>                 <data android:scheme="directory"/>             </intent-filter>             <meta-data android:name="android.app.searchable"                        android:resource="@xml/searchable"/>         </activity> 

you don't need in manifest file. use android's share intent share content other applications on device. here documentation: http://developer.android.com/training/sharing/send.html

the example:

intent shareintent = new intent(); shareintent.setaction(intent.action_send); shareintent.putextra(intent.extra_stream, uritoimage); shareintent.settype("image/jpeg"); startactivity(intent.createchooser(shareintent, getresources().gettext(r.string.send_to))); 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo