0

I am working on a simple android file manager. The problem I am facing is getting my app to upload files to another app or site when someone wants to send files and such. I tried reading through the developer docs, but they were a bit confusing. How can I set up my MainActivity(If that is a good place to put this) to handle this and allow the uploading of files? Here is what I have in my 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>
4

1 回答 1

0

您的清单文件中不需要任何内容​​。使用 Android 的共享意图与设备上的其他应用程序共享内容。这是文档:http: //developer.android.com/training/sharing/send.html

这个例子:

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)));
于 2013-08-18T19:32:16.640 回答