文件对话框替换? [英] File dialogue replacement?
问题描述
我有一个小的应用程序,其中一些人可以有一个1:与对方聊天1。现在我想实现共享一些文件可能(图像,声音,无论...)。
I have a small app where some people can have a 1:1 chat with each other. Now I want to implement a possibility to share some files (images, sounds, whatever,...).
我的问题:我需要一种可能性,让用户选择这样的文件。因为我没有找到某种文件对话框为Android的:什么是做到这一点的最好办法
My problem: I need a possibility to let the user choose such a file. Since I did not find some kind of "file dialogue" for Android: what is the best way to do this?
我并不需要一个随时可以使用的解决方案,但只是一些提示/想法如何可以这样做出来的应用程序。
I do not need a ready-to use solution but just some hints/ideas how this could be done out of an app.
谢谢!
推荐答案
您可以有一个按钮在屏幕,点击该按钮,让使用下面code用户选择GALLARY文件,
You can have one Button in your screen and clicking on that button let user choose a file from gallary using below code,
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);//
startActivityForResult(Intent.createChooser(intent, "Select Picture"),SELECT_IMAGE);
这篇关于文件对话框替换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!