2014年7月16日星期三

get the URI of an image resource in android

Reference:http://androidbook.blogspot.jp/2009/08/referring-to-android-resources-using.html

Two methods:

  1. android.resource://[package]/[res id]
  2. android.resource://[package]/[res type]/[res name]

Example:

  1. Uri.parse("android.resource://com.example.test/“ + R.drawable.ic_launcher)
  2. Uri.parse("android.resource://com.example.test/drawable/ic_launcher")

没有评论:

发表评论