vendredi 6 février 2015

Passing a Method into an AsyncTask using Reflection considered "bad practice"?

My situation looks like this: I have an object containing two methods. Some times I want to run method 1 in an AsyncTask, and other times I want to run method 2. Using Reflection/Method I can pass in the method I want to be run in the AsyncTask as a parameter, and otherwise I have to implement separate AsyncTasks for the different methods.


Is it considered bad practice to pass a Method into an AsyncTask? I'm very new to the concept of Reflection, and it sounds pretty powerful, but I'm not sure if it is considered "bad"?






Aucun commentaire:

Enregistrer un commentaire