如何在jetpack compose中实现电话号码可视化转换?我已经阅读了这篇文章以获取卡号。
我想像这样格式化我的电话号码xx xxx xx xx
我在 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但是当我尝试构建我的项目时,它给了我这个错误:
\nExecution 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 运行的输出
\nhttps://gist.github.com/javlonrahimov/95de968645cace1dfb6e425381f8014b
\n如果我删除 BottomSheetFragmen() 上方的 @AndroidEntryPoint,它将构建并安装应用程序。但是当我尝试打开 BottomSheet 时,当我将存储库注入 …
我正在使用此代码:
MediaStore.Images.Media.insertImage(getContentResolver(), bitmap, "title" , "description");
Run Code Online (Sandbox Code Playgroud)
它运行良好。
问题:
public static String insertImage (ContentResolver cr, String imagePath, String name, String description)
此方法在 API 级别 29 中已弃用。插入图像应使用 MediaColumns#IS_PENDING 执行,它提供了对生命周期的更丰富的控制。
我已经阅读了文档,但实际上并不了解 IS_PENDING 以及如何使用它。
android ×3
android-10.0 ×1
dagger-hilt ×1
gradle ×1
image ×1
phone-number ×1
save ×1
textfield ×1