How to create Form from Json schema and Ui schema in Android Kotlin

60
November 17, 2021, at 12:30 PM

How to create Form from Json schema and Ui schema in Android Kotlin? I am new to mobile development and am a little bit confused how to do this in Jetpack Compose app. I find many ways to create a form in React. For Android Kotlin there is https://github.com/ellykits/neat-form , but it requires a different schema structure of Json schema. I have Json schema as below:

{
  "title": ".....",
  "description": "",
  "type": "object",
  "required": [
    "description",
    "violationType"
  ],
  "properties": {
    "videoLink": {
      "type": "string",
      "title": "Видео",
      "default": "https://....."
    },
    "description": {
      "type": "string",
      "title": "....."
    },
    "violationType": {
      "type": "string",
      "title": ".......?",
      "enum": [
        ".....",
        ".....",
        ".....",
        ".....",
        "....."
      ]
    }
  }
}

and Ui schema:

{
  "description": {
    "ui:widget":"textarea"
  },
  "violationType": {
    "ui:widget":"radio"
  },
  "videoLink": {
    "ui:widget": "customVideoWidget"
  },
  "ui:order": [
    "videoLink",
    "description",
    "violationType"
  ]
}

And could you advice me what can I read to understand how to work with Json schema to create forms?

Thank you very much for advance.

Answer 1

I think it can be done by creating a factory class and pass form item and it will decide with FormItemView to return.

FormItemView is a view extending for example MaterialTextInput and sets input type and placeholder, etc that it gets from json.

READ ALSO
How would I automatically update html links if image location is physically moved?

How would I automatically update html links if image location is physically moved?

I've always used Dreamweaver and if I link to, say, an image and then subsequently physically move the location of that image (within the Dreamweaver environment) Dreamweaver automatically updates the link in the codeSo, I have an image in index

45
laravel {{ $loop->index }} & jquery count++

laravel {{ $loop->index }} & jquery count++

Using the Laravel blade template, is there a way to include a variable and increase each time in the foreach, or what is the better approach?

49
How to create overlapping images using CSS

How to create overlapping images using CSS

I have created 5 images overlapping each other but I am stuck on this part ("Whenever the mouse is placed over any of the images that image must move to the front of the group and be the primary image on displayWhen the mouse has pulled away the image will return...

35
Updated SSL Certificate for android application

Updated SSL Certificate for android application

How to update the SSL certificate for the app which is already in usedo we need to update whenever SSL expires? I'm using retrofit

47