Skip to main content

Command Palette

Search for a command to run...

Android Tips #8

Combine multiple tasks into single one.

Updated
1 min read
Android Tips #8
R

Senior Android Engineer from Bangladesh. Love to contribute in Open-Source. Indie Music Producer.

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)

Practical Scenario:

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.

index.png