1

I'm working on a native Android application where screens need to be rendered dynamically based on data received at runtime. The application is database-driven, and we aim to support customization for end-users, so we cannot rely on predefined XML layouts.

I'm exploring whether there's any Android framework support for this kind of dynamic UI generation. Specifically:

Is there any XML-like scripting or markup language that Android supports at runtime to define and render views?

I'm considering sending data from C++ to Kotlin—possibly in a format like HTML or a structured markup—which Kotlin could then use to create and display widgets dynamically.

Does Android OS have any built-in capability for such markup-based dynamic view creation Essentially, I’m looking for a way to generate UI programmatically from markup or structured data passed from the native side.

To clarify what I mean, here’s an analogy from another platform:

On Windows, it's possible to define UI dynamically using runtime XAML strings, like this:

static void createxaml(hstring & str) {

 

        str = LR"(

                 <Button

                   xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation

                   Name="MyButton"

                   Content="Click Me"

                   Width="200"

                   Height="60"

                   HorizontalAlignment="Center"

                   VerticalAlignment="Center"

                   FontSize="18"

                   FontFamily="Segoe UI"

                   Foreground="White"

                )";

    }

{

 

        hstring xaml;

    createxaml(xaml);

    Button obj = XamlReader::Load(xaml).as<Button>();

}

1 Answer 1

0

Does Android OS have any built-in capability for such markup-based dynamic view creation

Other than rendering HTML in a WebView, no.

You are welcome to explore third-party solutions, mostly in the server-defined UI (SDUI) space.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.