0

I have a DialogFragment that displays some options in a list for the user to click on (e.g. "Do This", "Load X", "Do That", whatever).

When you click this it invokes a callback to a function which I've defined in another class, which is a switch statement determining what to do next now that the user has chosen an option.

However I've also provided the ability for the user to send in their own String[] to the DialogFragment to display their own options.

But this also means that now the callback switch statement would need to change as well.

So is there a way to say "If you are sending in your own String[], force the developer to override the function containing the switch statement"?

Or is this one of those things where you just have to leave a comment somewhere telling them that if they are passing in an argument to the DialogFragment they should probably override that switch-case function so the actions match up with the option labels?

KaliMa
  • 1,970
  • 6
  • 26
  • 51
  • Could you create an interface containing the methods they need? Then when they use your framework in general the could implement that interface – paul Oct 20 '16 at 16:15
  • You may want to look into `abstract` classes – Shaishav Oct 20 '16 at 16:27
  • 1
    I am already using abstract classes / interfaces. The problem is enforcing that two things are overloaded in tandem if they want to use custom options – KaliMa Oct 20 '16 at 16:27

0 Answers0