android: content URI的真实路径获取
16lz
2021-01-23
URL(Uniform Resource Locator):统一资源定位符URI(Uniform Resource Identifier):统一资源标识符
Intent intent=getIntent();Uri uri=intent.getData();String data=uri.toString();String RealPath="";if(ContentResolver.SCHEME_CONTENT.equals(uri.getScheme())){ Cursor cursor = this.getContentResolver().query(uri, new String[]{MediaStore.Images.ImageColumns.DATA}, null, null, null); if (null != cursor) { if (cursor.moveToFirst()) { int index = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA); if (index > -1) RealPath = cursor.getString(index); } cursor.close(); }}Log.d("Debug",RealPath);
更多相关文章
- [Android]关于filed 遍历资源文件的排序问题
- android 获取不同res下的资源id
- android 开发论坛资源URL
- 赵雅智_Android的getResources()资源引用
- Android如何根据当前显示配置匹配资源 layout / drawable
- android的一些开发的资源
- android 资源res下目录使用
- android 字符串数组资源
- android UI设计之 背景透明色 项目资源文件关系