1

How to create a piece of UI that can be used across multiple activities without duplicating the layout and business logic? Please provide some kind of example. Thank you.

Noman Arain
  • 1,102
  • 3
  • 18
  • 45

3 Answers3

2

You can reuse layout like this. Also, see this answer.

Community
  • 1
  • 1
crnlx
  • 2,549
  • 16
  • 20
1

This is relatively simple and there are a few ways to do it, but essentially you want to create a custom UI component. The Documentation describes it a few approaches here, and there are a few tutorials out there as well as SO questions:

Community
  • 1
  • 1
JRaymond
  • 11,495
  • 5
  • 36
  • 40
0

In addition to the other answers, fragments can fill the role you are seeking.

CommonsWare
  • 954,112
  • 185
  • 2,315
  • 2,367