小编Jav*_*lon的帖子

Jetpack compose 中的电话号码视觉转换

如何在jetpack compose中实现电话号码可视化转换?我已经阅读了这篇文章以获取卡号。

我想像这样格式化我的电话号码xx xxx xx xx

android phone-number textfield android-jetpack-compose

6
推荐指数
2
解决办法
1万
查看次数

Dagger-Hilt @AndroidEntryPoint 不适用于 BottomSheetDialogFragment()

我在 BottomSheetDialogFragmet() 中使用 ViewModel,所以我必须用 @AndroidEntryPoint 标记我的 BottomSheet。

\n
@AndroidEntryPoint\nclass SearchAddressDialog : BottomSheetDialogFragment() {\n\n    private val viewModel: MyAddressesViewModel by viewModels()\n    \n    ......\n}\n
Run Code Online (Sandbox Code Playgroud)\n

但是当我尝试构建我的项目时,它给了我这个错误:

\n
Execution failed for task \':app:kaptDebugKotlin\'.\n> A failure occurred while executing \norg.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction\n> java.lang.reflect.InvocationTargetException (no error message)\n\n* Try:\nRun with --stacktrace option to get the stack trace. Run with --info or --debug option \nto get more log output. Run with --scan to get full insights.\n
Run Code Online (Sandbox Code Playgroud)\n

这是我使用 --stacktrace 运行的输出

\n

https://gist.github.com/javlonrahimov/95de968645cace1dfb6e425381f8014b

\n

如果我删除 BottomSheetFragmen() 上方的 @AndroidEntryPoint,它将构建并安装应用程序。但是当我尝试打开 BottomSheet 时,当我将存储库注入 …

android gradle dagger-hilt bottomsheetdialogfragment

5
推荐指数
1
解决办法
4966
查看次数

将位图图像保存到画廊 android 10 的特定位置

我正在使用此代码:

MediaStore.Images.Media.insertImage(getContentResolver(), bitmap, "title" , "description");
Run Code Online (Sandbox Code Playgroud)

它运行良好。

问题:

  1. 它会自动在图库中创建一个名为“图片”的文件夹。但我想要不同的名称,例如我的应用程序的名称。
  2. MediaStore 的 insertImage() 函数在 android 10 中折旧

public static String insertImage (ContentResolver cr, String imagePath, String name, String description)

此方法在 API 级别 29 中已弃用。插入图像应使用 MediaColumns#IS_PENDING 执行,它提供了对生命周期的更丰富的控制。

我已经阅读了文档,但实际上并不了解 IS_PENDING 以及如何使用它。

android image save android-10.0

3
推荐指数
1
解决办法
4299
查看次数