Search code examples
androidlayout

Can I have a page of my app without a layout on Android?


I'm comming from IOS development and I probably have a lot of vicious while developing this app for Android.

When I was on IOS, I had a lot of viewcontroller without a visual file (I never used storyboards). Every screen of the app was behind coded. I want to know if I can do the same in Android. I have an option to not use the visual class?

Btw, I know my question can be confuse. Sorry for that

Thanks anyway


Solution

  • Yes. The typical approach is to use an XML file and call

    setContentView(R.layout.layout_name);

    to assign that view to the Activity but you could also create your view programmatically and use the same function on a View java object.

    This tutorial explains how in more detail