java - 如何在从本机android访问颤振资源时将键字符串转换为可绘制(int)
问题描述
我正在尝试从我的根文件夹中访问图像。
在根文件夹中,我有
assets
test.jpeg
我还包含在我的pubspec.yaml
flutter:
assets:
- assets/test.jpeg
现在在我的java代码中,我有这个:
FlutterLoader loader = FlutterInjector.instance().flutterLoader();
String key = loader.getLookupKeyForAsset("assets/test.jpeg");
现在,基于此:我需要 decodeResources 将 Integer 作为参数
Bitmap bmp = BitmapFactory.decodeResource(mContext.getResources(), what will I put here...);
在android中我可以这样做:
Bitmap bmp = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.test.jpeg);
基于这个答案here
解决方案
推荐阅读
- python - 从父窗口将布局添加到另一个布局
- powershell - 谁最后使用 Powershell 查询修改了文档 (Sharepoint)
- android - 将 iOS 和 Android 应用程序转移到不同的开发者帐户 - 最终用户的商店链接是否会改变?
- symfony - 如何翻译多种语言的键索引 XLIFF 文件?
- python - 使用 *args 返回偶数
- python - 合并带有更改的 JSON 文件
- javascript - 从包含我的 JSON 数据的浏览器中使用 URL 时,d3.json() 不起作用
- javascript - 使用ejs格式时,js中的Document替换什么
- javascript - 如何将带有选项的选择中的箭头更改为内联 SVG?
- laravel - Laravel - 如何根据数据库中的特定条件隐藏 div