@Test public void onActivityResultWithInvalidIntentShouldShowErrorToast() { Intent intent = new Intent(); mainActivity.onActivityResult(MAP_ACTIVITY_REQUEST_CODE, Activity.RESULT_OK, intent); assertEquals(context.getString(R.string.error_msg_could_not_retrieve_chosen_feature), ShadowToast.getTextOfLatestToast()); }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch(requestCode) { case MAP_ACTIVITY_REQUEST_CODE: if (resultCode == Activity.RESULT_OK) { if (data.hasExtra(NEW_FEATURE_POINTS_JSON)) { saveDroppedPoints(data); } String geoJSONFeature = getString(R.string.error_msg_could_not_retrieve_chosen_feature); if (data.hasExtra(Constants.PARCELABLE_KEY_GEOJSON_FEATURE)) { geoJSONFeature = data.getStringExtra(Constants.PARCELABLE_KEY_GEOJSON_FEATURE); } Toast.makeText(this, geoJSONFeature, Toast.LENGTH_LONG) .show(); } break; default: break; } }
MainActivity extends BaseNavigationDrawerActivity { @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch(requestCode) { case MAP_ACTIVITY_REQUEST_CODE: if (resultCode == Activity.RESULT_OK) { if (data.hasExtra(NEW_FEATURE_POINTS_JSON)) { saveDroppedPoints(data); } String geoJSONFeature = getString(R.string.error_msg_could_not_retrieve_chosen_feature); if (data.hasExtra(Constants.PARCELABLE_KEY_GEOJSON_FEATURE)) { geoJSONFeature = data.getStringExtra(Constants.PARCELABLE_KEY_GEOJSON_FEATURE); } Toast.makeText(this, geoJSONFeature, Toast.LENGTH_LONG) .show(); } break; default: break; } } }
MainActivity extends BaseNavigationDrawerActivity { @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch(requestCode) { case MAP_ACTIVITY_REQUEST_CODE: if (resultCode == Activity.RESULT_OK) { if (data.hasExtra(NEW_FEATURE_POINTS_JSON)) { saveDroppedPoints(data); } String geoJSONFeature = getString(R.string.error_msg_could_not_retrieve_chosen_feature); if (data.hasExtra(Constants.PARCELABLE_KEY_GEOJSON_FEATURE)) { geoJSONFeature = data.getStringExtra(Constants.PARCELABLE_KEY_GEOJSON_FEATURE); } Toast.makeText(this, geoJSONFeature, Toast.LENGTH_LONG) .show(); } break; default: break; } }  }
MainActivity extends BaseNavigationDrawerActivity { @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch(requestCode) { case MAP_ACTIVITY_REQUEST_CODE: if (resultCode == Activity.RESULT_OK) { if (data.hasExtra(NEW_FEATURE_POINTS_JSON)) { saveDroppedPoints(data); } String geoJSONFeature = getString(R.string.error_msg_could_not_retrieve_chosen_feature); if (data.hasExtra(Constants.PARCELABLE_KEY_GEOJSON_FEATURE)) { geoJSONFeature = data.getStringExtra(Constants.PARCELABLE_KEY_GEOJSON_FEATURE); } Toast.makeText(this, geoJSONFeature, Toast.LENGTH_LONG) .show(); } break; default: break; } }  String readAssetFile(String inFile); @Override void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults); }
MainActivity extends BaseNavigationDrawerActivity { @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch(requestCode) { case MAP_ACTIVITY_REQUEST_CODE: if (resultCode == Activity.RESULT_OK) { if (data.hasExtra(NEW_FEATURE_POINTS_JSON)) { saveDroppedPoints(data); } String geoJSONFeature = getString(R.string.error_msg_could_not_retrieve_chosen_feature); if (data.hasExtra(Constants.PARCELABLE_KEY_GEOJSON_FEATURE)) { geoJSONFeature = data.getStringExtra(Constants.PARCELABLE_KEY_GEOJSON_FEATURE); } Toast.makeText(this, geoJSONFeature, Toast.LENGTH_LONG) .show(); } break; default: break; } }  String readAssetFile(String inFile); @Override void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults);  }