Implementing XML Parsing in ArkTS for HarmonyOS Applications
The ArkTS framework in HarmonyOS provides robust XML processing capabilities through its @ohos.xml module. This guide demonstrates practical implementation techniques using the XmlPullParser class with updated coding patterns.
Attribute Extraction Workflow
Initialize the parser with properly encoded XML data to hendle international character se ...
Posted on Wed, 04 Nov 2026 16:23:15 +0000 by The-Last-Escape
Building a Media Controller with Custom AVSession Communication in HarmonyOS
Media controller implementation leverages AVSession APIs to facilitate bidirectional communication with a media provider. The capabilities demonstrated here require a companion provider implementation for complete custom data flow, and controller interfaces are restricted to system-level applications.
Project Structure
entry/src/main/ets/
|---u ...
Posted on Sat, 31 Oct 2026 16:44:00 +0000 by kaje
Implementing Event Publishing and Subscription with Emitter and Custom Dialogs in HarmonyOS
Overview
This sample demnostrates how to implement event-driven communication using HarmonyOS Emitter and how to create custom dialogs for displaying advertisement information.
Preview
The application showcases an e-commerce flow with the following functionality:
Usage Instructions
An advertisement dialog appears on app launch and can be dismi ...
Posted on Fri, 23 Oct 2026 16:53:56 +0000 by lapith
HarmonyOS ArkTS UI Development Fundamentals
ArkTS is the primary language for building user interfaces on HarmonyOS, powered by the ArkUI declarative framework. This guide covers essential UI construction patterns, component composition, state management, layout systems, and advanced interaction techniques.
Custom Component Architecture
Components in ArkTS are defined using structural de ...
Posted on Wed, 14 Oct 2026 16:51:52 +0000 by joelg
Implementing Audio and Video Recording in HarmonyOS Applications
Overview
This technical guide demonstrates audio and video recording capabilities in HarmonyOS applications using the @ohos.multimedia.audio framework. The implemantation covers device switching, audio focus management, audio effects configuration, and various recording modes.
Functionality Overview
The application provides several audio-relate ...
Posted on Wed, 07 Oct 2026 16:50:21 +0000 by luminous
TypeScript Fundamentals for HarmonyOS Development
TypeScript Language Overview
TypeScript is a statically typed superset of JavaScript that compiles to plain JavaScript. It adds optional types, classes, and modules to JavaScript, helping catch errors early through static type checikng and making code more maintainable.
In the HarmonyOS ecosystem, ArkTS builds upon TypeScript by extending it wi ...
Posted on Mon, 28 Sep 2026 16:34:54 +0000 by ohjay
Building a Custom Verification Code Input Component in HarmonyOS ArkUI
Challenges with Multiple TextInput Components
Initial Focus: The system does not automatically determine which input field should receive focus upon initialization. This can be partially resolved by adding .defaultFocus(index == 0) to the first input.
Deletion Handling: The onChange event often fails to trigger when a user deletes characters ( ...
Posted on Mon, 28 Sep 2026 16:18:14 +0000 by youknowho
HarmonyOS State Management with ArkTS: Component and Application-Level Patterns
@State Decorator
The @State decorator is used to declare a state variable in a component. When the state variable changes, the component automatically re-renders.
Assigning Values to Class Properties
In HarmonyOS with ArkTS, you can assign values to class properties within components. Here's an example:
@Component
struct MyComponent {
@State ...
Posted on Thu, 03 Sep 2026 16:28:07 +0000 by benyboi
HarmonyOS NEXT Promise Await Exception Handling Without Cluttered Try-Catch Blocks
Async/await operasions throw errors when the underlying Promise rejects, halting eexcution of subsequent code. For example:
async function simulateRequest() {
console.log('Request initiated');
const response = await new Promise<string>((resolve, reject) => {
setTimeout(() => reject('Data fetch timeout'), 1200);
});
conso ...
Posted on Mon, 31 Aug 2026 16:30:53 +0000 by hkothari
Calling ArkTS Functions from Non-ArkTS Threads in HarmonyOS
Module Registration
First, we need to register the native module. This is done in the queue_work.cpp file:
// queue_work.cpp
EXTERN_C_START
static napi_value Init(napi_env env, napi_value exports) {
napi_property_descriptor desc[] = {
{ "queueWork", nullptr, QueueWork, nullptr, nullptr, nullptr, napi_default, nullptr }
...
Posted on Fri, 21 Aug 2026 16:48:40 +0000 by Tonsil