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

There two way to add view dynamically .

  1. you create you xml file .then using LayoutInflater you lnflater that xml to your view .

  2. Or You can create view dynamically like var textview=TextView()
    then textview.text=”xyz”

You need relativelayout or linearlayout where will add those will using addView(); method.

But i condition you have declare your view then you can customize at runtime.

you can check the example

Leave a Comment