I am creating a custom component in HarmonyOS using Java SDK, Where I have to perform some task after some delay with Component instance. In Android, we have postDelayed(Runnable action, long delayMillis) method in View class. So we can achieve above requirement as follow but, In HMOS java SDK, I seen there is no any api available for delay in
Tag: huawei-mobile-services
How to add image inside a tab as a icon while developing Harmony application?
I want to add an image inside the tab and I have Image Resource Id but tab.setIconElement(Element) takes element. currently, I am trying like this How can I add an image inside the tab or create its element with Image Resource Id only? Or is there any other way to do it? Answer First you have to decode the Image
What is the alternative in Harmony OS for Nullable and NonNull annotations?
There are many arguments in my code which can take the value null. It would be helpful if there is a @Nullable and @NonNull annotation like the ones offered in Android via Annotation. Is there an alternative available in Harmony OS? Answer You can use org.jetbrains.annotations.Nullable & org.jetbrains.annotations.NotNull annotations available from jetbrains dependency, implementation ‘org.jetbrains:annotations:20.1.0’
What is the alternative in Harmony OS for function setBackgroundColor() on View class in Android?
I am working on a HarmonyOS project in that I wanted to set the background color of the component. In Android we have a function setBackgroundColor() in the View class, this can be done as shown below. How can I set background color to a component in HarmonyOS? Answer First you have to build an Element using some color, later
How much 1px is with respect to fp in Harmony OS?
Can anyone tell px:fp ratio or code to convert fp to px. I am building a HarmonyOS application and I want to set the width of a component to 20fp but setWidth​(int width) takes width in px. Answer HarmonyOS provides the AttrHelper tool class to implement conversion between fp and px. AttrHelper.fp2px() For more details, pls kindly refer to this
HMS NoClassDefFoundError Android
I’m using HMS plugin for Android Studio. I have a class called MyFirebaseMessagingService which receives notifications from Firebase. it used to be like : after conversion: After converting the code, I had the following problem : I found a suggested solution in Huawei support, but it didn’t work! (Handle the exception) link : https://developer.huawei.com/consumer/en/doc/development/Tools-Guides/map-conversion-0000001050062227 Suggested solution : Add the following
Huawei HIAI Engine “General text recognition” is not detecting any text from an image
When using “General text recognition” from HIAI Engine I can’t make it detect and return any text. For instance for the sample image it returns empty text but with code 200. I used an example program from the HIAI documentation, so I don’t know where the problem is. So i created another app from scratch and results are the same.