1、通过R.drawable.**来获取文件的路径
     

protected static String getAbsoluteImagePath(Context context, Uri uri)  {
// can post image
String [] proj={MediaStore.Images.Media.DATA};
Cursor cursor = context.getContentResolver().query( uri,
proj, // Which columns to return
null, // WHERE clause; which rows to return (all rows)
null, // WHERE clause selection arguments (none)
null); // Order-by clause (ascending by name)

int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();

return cursor.getString(column_index); }
Resources r =  app.getApp().getApplicationContext().getResources(); Uri uri =  Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://"    + r.getResourcePackageName(R.drawable.favorite_detail_line) + "/"    + r.getResourceTypeName(R.drawable.favorite_detail_line) + "/"    + r.getResourceEntryName(R.drawable.favorite_detail_line)); String headLineString = getAbsoluteImagePath(app.getApp().getApplicationContext(), uri);

2、获取到表情路径的方法
     

Drawable d = EmoWindow.getDrawable(app.getApp(), app.getApp().getResources().getDisplayMetrics().density, i); if(d != null){           String filepath = "";            try { URLDrawable ud = (URLDrawable)d; if (ud.hasDiskCache()) { filepath = ud.getDiskCache().getAbsolutePath(); } } catch (Exception e) {  e.printStackTrace();     } }

更多相关文章

  1. android获取版本号
  2. Android(安卓)调用相册或相机选择图片
  3. Android:获取网页源代码
  4. android获取google邮箱
  5. Android获取、设置Wifi状态
  6. Android(安卓)获取drawable中图片的高度宽度
  7. 【Android】【基础】获取屏幕宽高
  8. Android(安卓)模拟器中AVD路径的修改
  9. Pycharm安装PyQt5的详细教程

随机推荐

  1. Android(安卓)merge
  2. android studio接入facebook登录和分享
  3. java.lang.RuntimeException: invalid ch
  4. Android(安卓)开发入门-使用 Intent 在活
  5. Android移动应用开发——用户注册
  6. Android(安卓)Property System
  7. 设置APP运行界面为竖屏,禁止屏幕旋转
  8. Android(安卓)Drawable颜色
  9. FlowLayout
  10. Android(安卓)studio 将字符串写入本地的