Source:
public void configureScreen(String td, String ta){ TestData.getInstance(this, this).addObserver(this); if (td != null) title.setText(td); else title.setText(getString(R.string.run_test_message)); String test = NetworkMeasurement.getTestName(this, test_name); testTitle.setText(test); testImage.setImageResource(NetworkMeasurement.getTestImageBig(test_name)); ArrayList<String> listItems = new ArrayList<>(); final ArrayList<String> urlItems = new ArrayList<>(); if (ta != null){ try { JSONObject taJson = new JSONObject(ta); JSONArray urls = taJson.getJSONArray("urls"); for (int i = 0; i < urls.length(); i++) urlItems.add(urls.getString(i)); } catch (JSONException e) { Alert.alertDialogWithAction(this, getString(R.string.invalid_parameter), getString(R.string.urls), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { goToMainActivity(); } }); e.printStackTrace(); } listItems.addAll(urlItems); } if (listItems.size() == 0 && test_name.equals("web_connectivity")){ listItems.add(getString(R.string.random_sampling_urls)); mUrlListAdapter = new UrlListAdapter(this, listItems, false); } else mUrlListAdapter = new UrlListAdapter(this, listItems, true); if (listItems.size() == 0) urls.setVisibility(View.INVISIBLE); runButton.setOnClickListener( new ImageButton.OnClickListener() { public void onClick(View v) { TestData.doNetworkMeasurements(getApplicationContext(), test_name, urlItems); goToMainActivity(); } } ); testUrlList.setAdapter(mUrlListAdapter); LinearLayoutManager layoutManager = new LinearLayoutManager(this); testUrlList.setLayoutManager(layoutManager); }

Target:
public void configureScreen(String td, String ta){ TestData.getInstance(this, this).addObserver(this); if (td != null) title.setText(td); else title.setText(getString(R.string.run_test_message)); String test = NetworkMeasurement.getTestName(this, test_name); testTitle.setText(test); testImage.setImageResource(NetworkMeasurement.getTestImageBig(test_name)); ArrayList<String> listItems = new ArrayList<>(); final ArrayList<String> urlItems = new ArrayList<>(); if (ta != null){ try { JSONObject taJson = new JSONObject(ta); JSONArray urls = taJson.getJSONArray("urls"); for (int i = 0; i < urls.length(); i++) urlItems.add(urls.getString(i)); } catch (JSONException e) { Alert.alertDialogWithAction(this, getString(R.string.invalid_parameter), getString(R.string.urls), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { goToMainActivity(); } }); e.printStackTrace(); return; } listItems.addAll(urlItems); } if (listItems.size() == 0 && test_name.equals("web_connectivity")){ listItems.add(getString(R.string.random_sampling_urls)); mUrlListAdapter = new UrlListAdapter(this, listItems, false); } else mUrlListAdapter = new UrlListAdapter(this, listItems, true); if (listItems.size() == 0) urls.setVisibility(View.INVISIBLE); runButton.setOnClickListener( new ImageButton.OnClickListener() { public void onClick(View v) { TestData.doNetworkMeasurements(getApplicationContext(), test_name, urlItems); goToMainActivity(); } } ); testUrlList.setAdapter(mUrlListAdapter); LinearLayoutManager layoutManager = new LinearLayoutManager(this); testUrlList.setLayoutManager(layoutManager); }