The simplest way is to do it in that order:
- Create grid
- start asynctask (for example) to load items from database 3 if data exists, add them to grid
- start asynctask to load data from network
- insert data into database ( except all that not exists there)
- start asynctask to load from database and add them to grid