Working on kotlin android volley i found that calling a separate fun for volley response takes some time in that time kotlin start running next lines of code written which is very painful for me…
Code is like
class pnr{
1 val server = server1_http()
2 server.httpRequest_route(train.getString(“number”), baseContext)
///////// it is expected that kotlin should complete upper task first then go to below line

3 val route_object: JSONObject =JSONObject( MySharedPrefrence.getPnrRouteObject(baseContext)) ///this line should be run after 2 line

tell me guys where i am going wrong here . line no 2 is also excuted but after line 3