Drawable appIcon = packageManager
.getApplicationIcon(packageInfo.applicationInfo);
如何获取appIcon
的uri?
答案 0 :(得分:0)
Uri uri = Uri.parse("android.resource://your.package.here/drawable/image_name");
InputStream stream = getContentResolver().openInputStream(uri);
使用ContentResolver打开资源URI
答案 1 :(得分:0)
格式为:
"android.resource://[package]/[res id]"
[package] is your package name
[res id] is value of the resource ID, e.g. R.drawable.sample_1
to stitch it together, use
Uri path = Uri.parse("android.resource://your.package.name/" + R.drawable.sample_1);