//create a callback interface interface Callback { void onData(Map<String, String> mappedData); } Handler handler = new Handler(); Runnable runnable = new Runnable() { @Override public void run() { //pass the callback as a param refreshVars(firstname, lastname, id, new Callback() { //Override void onData( Map < String , String > mappedData) { //This will be called from the onResponse method on refreshExitVars //do whatever you want with your data here. It won’t be empty. } };); String newlastdate = varList.get( "newlastdate" ); String newcurrentdate = varList.get( "newcurrentdate" ); /*UI changes related to "newlastdate" and "newcurrentdate"*/ } handler.postDelayed( this , 60000 ); } }; handler.postDelayed(runnable, 60000 ); public void refreshExitVars(final String FN, final String LN, final String IDN, final Callback callback){ final Map<String, String> list = new HashMap<>(); Response.Listener<String> responseListener = new Response.Listener<String>() { @Override public void onResponse(String response) { try { JSONObject jsonResponse = new JSONObject(response); boolean success = jsonResponse.getBoolean( "success" ); if (success) { String nlastdate = jsonResponse.getString( "date" ); String ncurrentdate = jsonResponse.getString( "currentdate" ); list .put( "newlastdate" , nlastdate); list .put( "newcurrentdate" , ncurrentdate); //Use the callback object to transfer data. callback.onData( list ); } else { int ErrorCode = jsonResponse.getInt( "errorcode" ); AlertDialog.Builder builder; builder = new AlertDialog.Builder(Exit. this ); builder.setMessage( "" + ErrorCode) .setNegativeButton( "Close" , new DialogInterface.OnClickListener() { @ Override public void onClick (DialogInterface dialog, int which) { this .finish(); } }) .create() .show(); } } catch (JSONException e) { e.printStackTrace(); } } }; RequestUIChanges requestUIChanges = new RequestUIChanges(FN, LN, IDN, responseListener); RequestQueue queue = Volley.newRequestQueue(Exit. this ); queue .add(requestUIChanges); //No value should be returned from here. //return list; } // Check out the bold text. Correct any syntax errors. I've just typed it here.