A.s.ALI
A.s.ALI

Reputation: 2082

Android Override file from library/base

I have made a project in which I have made my source as base and made other modules per client dependent on base source which we call as library.

Those modules have dependency on our base code. All they are doing is starting BaseMainActivity from MainActivity of the Module. And rest is handled by BaseMainActivity

So here is a structure depiction as following

  • Client1 ---> Having its own res folder, main folder and gradle/manifest file
  • Client2 ---> Having its own res folder, main folder and gradle/manifest file
  • Client3 ---> Having its own res folder, main folder and gradle/manifest file
  • BaseProject ---> Having its own res folder, main folder and gradle/manifest file

Here now one of our client has changed some requirement. Now For that specific client I have to override some functionalities in that specific java file. I know concept of flavors that I am already using as Production and Demo for each client. But that does not fit into my criteria.

Please tell me how to achieve this.?? Ask me question if I am not clear.

Upvotes: 1

Views: 350

Answers (1)

mesibo
mesibo

Reputation: 4323

One straightforward solution would be to extend your BaseMainActivity to BaseMainActivityForSpecificClient and override changes there.

Your other client continue to use BaseMainActivity while your this client can start BaseMainActivityForSpecificClient.

Upvotes: 1

Related Questions