2015-05-19 56 views

回答

0
Uri uri = Uri.parse("android.resource://your.package.here/drawable/image_name"); 
InputStream stream = getContentResolver().openInputStream(uri); 

使用ContentResolver的開放資源的URI

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); 
+0

提拉不是從我的包來了... –