Android file transfer/Upload
一. 若想在Android上利用系统已有的Intent 发送/上传文件,可以尝试如下:
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setType("image/jpg");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f) );
startActivity(intent);
系统会弹出可供选择的Intent。
如果想要指定的Intent,那么再设置component参数即可:
setComponent(new Component("com.android.***/*Packagename*/"),("com.android.***.###/*full class name*/"))
如果想发生/上传多个文件,那么请使用ACTION_SEND_MULTIPLE
对应的Extra设置方法,需要调整为put*ArrayListExtra,其它依样画葫芦就可以了。
二. 格外补充:
如果希望自行开发的Intent支持类似的功能,那么需要在自己的功能注册进系统中。
在Menifest中的相应Activity中加入类似代码。
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="yourapp/yourtype" />
</intent-filter>
别人就是使用如下代码调用了:
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setType("yourapp/yourtype");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f) );
startActivity(intent);
分享到:
相关推荐
Mac查看Android文件(AndroidFileTransfer.dmg) Android File Transfer Browse and transfer files between your Mac computer and your Android device. DOWNLOAD NOW Supports macOS 10.7 and higher. By ...
Google官方出品Mac与android文件传输工具,Google官方出品Mac与android文件传输工具 链接:https://u20385572.ctfile.com/fs/20385572-376100378
MAC上查看安卓手机利器!
androidfiletransfer.dmg 官网无法下载 这里可以哦
Google开发的AndroidFileTransfer,用作Android和Mac进行文件传输。Google开发的AndroidFileTransfer,用作Android和Mac进行文件传输。Google开发的AndroidFileTransfer,用作Android和Mac进行文件传输。Google开发...
Android 手机在 Mac OS X 下如何连接? 需求很简单,拷一点软件、音乐、电影到sd里面,osx下面怎么办啊? 下载 Android File Transfer就完美解决了所有 Android 手机在mac上的支持!
MAC上查看安卓手机利器!,方便快捷好用,安装简单,操作简单
替换sdk路径下/platforms/android-28/android.jar,能够解决在android studio 看源码部分类报红及能够正常编译项目。解决替换as后报错:Failed to transform file 'android.jar' to match attributes {artifactType=...
Android File Transfer安卓和mac互传文件通过usb,usb链接安卓手机和macbook打开手机文件夹来拷贝文件。
mac 连接安卓手机需要的组件 造福没有梯子的各位 解压后就是 dmg 文件
Mac电脑与Android手机之间,文件传送用的,移动应用测试开发使用,解压即可以使用,无需安装
Android中安装asset下的apk
MAC查看安卓手机文件的软件
安卓开发者网站https://developer.android.com/官网下载 国内好像不能直接访问,真是不懂这个网站为什么会被墙
android_webkit android_webkit android_webkit android_webkit android_webkit android_webkit android_webkit android_webkit android_webkit
mac os 上查看Android手机上文件的管理工具, 有需要的可以下载一下。解压放到软件下面就可以了。
替换sdk路径下/platforms/android-29/android.jar,能够解决在android studio 看源码部分类报红及能够正常编译项目。解决替换后报错:Failed to transform file 'android.jar' to match attributes {artifactType=...
使用xUtils进行图片文件的上传,可进行调用手机拍照与打开图库
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.tigongzhe" android:versionCode="1" android:versionName="1.0" > android:minSdkVersion="8" android:...