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,172
  • 4
  • 19
  • 45

3 Answers3

2

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

Community
  • 1
  • 1
Sujith Surendranathan
  • 2,569
  • 17
  • 21
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,625
  • 5
  • 37
  • 40
0

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

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491