質問

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,...).

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.

Thanks!

役に立ちましたか?

解決

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);
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top