Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.activity_patient_info); addEditPatientFragment = (AddEditPatientFragment) getSupportFragmentManager().findFragmentById(R.id.patientInfoContentFrame); if (addEditPatientFragment == null) { addEditPatientFragment = AddEditPatientFragment.newInstance(); } if (!addEditPatientFragment.isActive()) { addFragmentToActivity(getSupportFragmentManager(), addEditPatientFragment, R.id.patientInfoContentFrame); } Bundle patientBundle = savedInstanceState; if (patientBundle != null) { patientBundle.getString(ApplicationConstants.BundleKeys.PATIENT_ID_BUNDLE); } else { patientBundle = getIntent().getExtras(); } String patientID = ""; if (patientBundle != null) { patientID = patientBundle.getString(ApplicationConstants.BundleKeys.PATIENT_ID_BUNDLE); } List<String> countries = Arrays.asList(getResources().getStringArray(R.array.countries_array)); ApplicationInfo applicationInfo = null; try { applicationInfo = this.getPackageManager().getApplicationInfo(this.getPackageName(), PackageManager.GET_META_DATA); } catch (PackageManager.NameNotFoundException e) { Log.e(getString(R.string.package_manager),e.getMessage()); } Bundle bundle = applicationInfo.metaData; String googleMapToken = bundle.getString(getString(R.string.google_API_key_token)); if (!Places.isInitialized()) { Places.initialize(getApplicationContext(), googleMapToken); } PlacesClient placesClient = Places.createClient(this); mPresenter = new AddEditPatientPresenter(addEditPatientFragment, countries, patientID, placesClient); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.activity_patient_info); addEditPatientFragment = (AddEditPatientFragment) getSupportFragmentManager().findFragmentById(R.id.patientInfoContentFrame); if (addEditPatientFragment == null) { addEditPatientFragment = AddEditPatientFragment.newInstance(); } if (!addEditPatientFragment.isActive()) { addFragmentToActivity(getSupportFragmentManager(), addEditPatientFragment, R.id.patientInfoContentFrame); } Bundle patientBundle = savedInstanceState; if (patientBundle != null) { patientBundle.getString(ApplicationConstants.BundleKeys.PATIENT_ID_BUNDLE); } else { patientBundle = getIntent().getExtras(); } String patientID = ""; if (patientBundle != null) { patientID = patientBundle.getString(ApplicationConstants.BundleKeys.PATIENT_ID_BUNDLE); } List<String> countries = Arrays.asList(getResources().getStringArray(R.array.countries_array)); ApplicationInfo applicationInfo = null; try { applicationInfo = this.getPackageManager().getApplicationInfo(this.getPackageName(), PackageManager.GET_META_DATA); } catch (PackageManager.NameNotFoundException e) { Log.e("Package Manager", e.getMessage()); } Bundle bundle = applicationInfo.metaData; String googleMapToken = bundle.getString("com.google.android.geo.API_KEY"); if (!Places.isInitialized()) { Places.initialize(getApplicationContext(), googleMapToken); } PlacesClient placesClient = Places.createClient(this); mPresenter = new AddEditPatientPresenter(addEditPatientFragment, countries, patientID, placesClient, getApplicationContext()); }