我尝试了很多方法,但并没有返回我想要的路径,我怎样才能得到绝对路径?
这是我找回的
/document/image:29163
意图守则
binding.buttonSetVoiceGallery.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setType("*/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(intent, 0);
}
});
当activityresult
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 0 && resultCode == RESULT_OK) {
Log.d(TAG,data.getData().getPath());
}
}
3条答案
按热度按时间kh212irz1#
请尝试以下代码以获取绝对路径:
wmvff8tz2#
ymzxtsji3#