I have made a splash screen where im syncing data from server to sqlite. I have to make few requests (lets say 5 request for 5 tables), and then the splash screen goes off and main activity starts. Please share some ideas as Im clueless how to achieve this. I have left no stone unturned in stackoverflow but could not find a perfect workaround.
            Asked
            
        
        
            Active
            
        
            Viewed 287 times
        
    1 Answers
0
            
            
        Add Volley https://stackoverflow.com/questions/16659620/volley-android-networking-library?rq=1
Then you can make calls from volley
     JsonObjectRequest jsonObjReq = new   JsonObjectRequest(com.android.volley.Request.Method.POST, Url__, ipObject,
                            new Response.Listener<JSONObject>() {
                                @Override
                                public void onResponse(JSONObject response) {
                                listener.resultJson(null, response);
            }, new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
    }
listener.resultJson(null, response); will get the responce from server and save this responce to your Sqlite.Finally close your Spalsh .
 
    
    
        VV W
        
- 169
- 7
- 
                    Yes, I know using volley library and make a simple request. Im asking how to make 5 concurrent requests and start main activity **after all the requests are completed**. – Rakesh May 30 '18 at 06:06
- 
                    send your all requests to mRequestQueue = Volley.newRequestQueue(context); jsonObjReq.setTag("TAG"); mRequestQueue .add(jsonObjReq); OR Create new Thread for Service call – VV W May 30 '18 at 06:21
- 
                    It will be helpful with an example. I am still unable to get it where should I start the intent for main activity? Thanks – Rakesh May 30 '18 at 07:23
