上传单张或多张图片至安卓设备。

huangapple 未分类评论56阅读模式
英文:

upload one image OR multiple image in android

问题

如何修改我的代码以在我的应用程序中添加一个选项,让用户可以选择上传单张或多张照片到他们的个人资料中?
目前,我正在使用以下代码......,但它不允许用户选择单张图片,而且至少要上传2张照片。

那么我应该如何修改我的代码?

Intent intent = new Intent();
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "选择图片"), CODE_MULTIPLE_IMG_GALLERY);
英文:

How can I change my code to put an option in my application which give the user the option to choose either a single for a couple of photos to upload in their profile?
At the moment I'm using the following code ....... ,but it doesn't allow the user to choose a single image and its limits is at least 2 photos

So how should I change my code?

Intent intent = new Intent();
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "select images"), CODE_MULTIPLE_IMG_GALLERY);

huangapple
  • 本文由 发表于 2020年4月6日 01:17:05
  • 转载请务必保留本文链接:https://java.coder-hub.com/61046460.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定