how to run java and xml code (fetched from api) into another fragment

前端 未结 3 848
孤城傲影
孤城傲影 2020-11-30 16:00

okay I will breifly define what I exactly want.I\'m getting an java code(for textview, button,etc) from api like this--> image description here and Xml code(for textview, bu

3条回答
  •  萌比男神i
    2020-11-30 16:20

    My Dear Friend, Unfortunately, It is not possible. as you are saying XML and java code from serverside. To run java code we need it to be compiled which is not possible on mobile.

    Hope you understand. But, what you can do is you can make a helper class which can parse JSON and returns a view which is generated from JSON and JSON contains element description like elementType, width, height, which can be predefined in server.

    Or you can use a Webview that loads a webpage from the server. and to use it in the application. or for some operation use intercept javascript.

提交回复
热议问题