karthi
karthi

Reputation: 1423

Android set constant Button in more than 5 activity

Hi I am new to Android I want to Set One Button named (Click) in More than Five Activity like Title of the Application at the Top.I did not want it to add on all the 5 activity Manually is there any simple way in Android?

Upvotes: 1

Views: 266

Answers (1)

Egor
Egor

Reputation: 40218

This is simple if you have one layout for all 5 activities, but you probably don't. So the solution is to create 5 buttons in each layout with same id. Then you can create a static method in one of your activities called, for example, initializeButton(). This method should inflate your button. You can call this method from every activity, and it should do the job. Hope this helps.

Upvotes: 1

Related Questions