Android Tips #8
Combine multiple tasks into single one.
1 min read
If get to know something new by reading my articles, don't forget to endorse me on LinkedIn
You can combine multiple tasks into single one (Zipping) (Synchronous execution). Simply, define list of Tasks and get list of Results (Success or Error)
Suppose, you have a form screen, where user can input multiple information. So, before sending informations to the backend server, you have to validate all those informations, let user know if there is any error. There can be multiple validations for each input from user.
Instead of writing all one by one multiple validations, you can define a list of **Task **which performs validation for every input and execute those to get the results (Either Success or Error). Thus you can combine all operations from validating to sending to server side which performs one by one. It's also easier to test the whole procedure or testing every single execution independently.