Questions tagged [harmonyos]

HarmonyOS is a family of operating systems developed by Huawei to developer as part of the initiatives for the all-scenario strategy, adaptable to mobile office, fitness and health, social communication, and media entertainment, to name a few. HarmonyOS is built on a distributed architecture designed based on a set of system capabilities. It is able to run on a wide range of device forms, including mobile phones, tablets, wearables, smart TVs, head units.

131 questions
1
vote
1 answer

How to implement method to launch App Gallery in HamonyOS application?

I am working on an open-source library for HarmonyOS app development which is used to prompt app users for rating the app on App Gallery. For that, I need to implement a method to launch the app gallery whenever the user agrees to give feedback. For…
1
vote
1 answer

How to use Fraction (alternative to Fragment) in Harmony OS?

I want to use fragments in my Harmony OS app, and I saw that Fraction is the alternative for it. However, I was unable to find any resource or tutorial as to how to implement it. Can anyone provide an example as to how to use Fraction and…
1
vote
2 answers

What is the alternative in harmony OS for imageview.setColorFilter in android?

In android, we can change the color of the drawable by using setColorFilter method. How do we do that in HarmonyOS?
1
vote
1 answer

How to initialise RgbColor from ability_main.xml?

I have a custom attribute of type RgbColor in my library, I wanted to know how can I initialise it to a specific color of my choice using ability_main.xml?
1
vote
2 answers

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?
1
vote
2 answers

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. View titleLayout =…
1
vote
2 answers

How to set the Xfermode in Paint object in Harmony OS?

How can we replicate the Android behaviour of this code snippet from SharpView library in Harmony OS? private PorterDuffXfermode mPorterDuffXfermode = new…
1
vote
1 answer

invalidate() in onDraw is not calling onDraw

I am using invalidate() in my onDraw to get a loading view but it is not starting the onDraw call. public void onDraw(Component component, Canvas canvas) { invalidate() }
1
vote
1 answer

How to set a custom font style to a text in Harmony Os i.e setting a new font which is not pre defined in Harmony OS?

I wanted to change the font style of text component(dayTitle) to a custom font for my project. For setting a predefined font ex:- BOLD, Harmony OS platform allows the users to set the predefined fonts in this manner…
1
vote
1 answer

What is the HarmonyOS alternative for RecyclerView in android?

I want to create dynamic lists which can be scrolled on the screen. To do this in Android, we create a custom adapter extending RecyclerView.Adapter, where ListItem is a class containing the content of list items extending…
1
vote
2 answers

How to inflate a layout in HarmonyOS with given context and layout resource id?

I am working on a HarmonyOS library where I have to inflate a layout with a given layout resource id: int layoutRes and context: Context context. In android, the same thing is done using LayoutInflater.from(context).inflate(layoutRes, this,…
1
vote
1 answer

What is the alternative in Harmony OS for shadow in TextView Android?

I am writing a custom component that displays text on the screen using Java SDK. I want to set a shadow on the text that this component renders like setting shadowRadius, shadowColor, shadowDx, shadowDy and also get these values that have been…
1
vote
1 answer

How to load local files/images that are stored in emulator/phone storage in HarmonyOS?

I am building a HarmonyOS application and want to load an image that I have in emulator/phone storage. How can I load this image in my Java class?
1
vote
2 answers

What is the Alternative for elevation attribute in HarmonyOS?

I am building a HarmonyOS application, Where I need to set elevation on custom component. In Android we can set elevation on and widget as follow android:elevation="8dp" but, I saw in HMOS there is no any elevation attribute present for view.
1
vote
2 answers

How to set up a PixelMap from resource in HarmonyOS?

In Android, we can create a Bitmap for a resource image/drawable using BitmapFactory: Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.image); How can we create a corresponding PixelMap from a resource id in HarmonyOS?
1 2 3
8 9