Source:
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View v = inflater.inflate(R.layout.fragment_bus_info, container, false); List<Fragment> fragmentList = new ArrayList<>(); markerTitle = (TextView) v.findViewById(R.id.mainName); desc1View = (TextView) v.findViewById(R.id.desc1); desc2View = (TextView) v.findViewById(R.id.desc2); dist = (TextView) v.findViewById(R.id.dist); String category = getArguments().getString("title"); String desc1 = getArguments().getString("desc1"); String desc2 = getArguments().getString("desc2"); String distance = getArguments().getString("distance"); icon = (ImageView) v.findViewById(R.id.icon); markerTitle.setText(category); desc1View.setText(desc1); desc2View.setText(desc2); dist.setText(distance); Log.d("Marker Title: ", category); switch (category){ case "microwave": icon.setImageResource(R.drawable.microwave_map_icon); markerTitle.setTextColor(getResources().getColor(R.color.orange)); break; case "Water Fountain": icon.setImageResource(R.drawable.waterbottle_map_icon); markerTitle.setTextColor(getResources().getColor(R.color.aqua)); break; case "Nap Pod": icon.setImageResource(R.drawable.sleeppod_map_icon); markerTitle.setTextColor(getResources().getColor(R.color.pink)); break; case "Ford Go Bike": icon.setImageResource(R.drawable.bike_icon); markerTitle.setTextColor(getResources().getColor(R.color.bike_blue)); break; case "Printer": icon.setImageResource(R.drawable.printer_icon); markerTitle.setTextColor(getResources().getColor(R.color.printer_green)); break; case "Mental Health": icon.setImageResource(R.drawable.mental_health_icon); markerTitle.setTextColor(getResources().getColor(R.color.mental_health_yellow)); break; } return v; }

Target:
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View v = inflater.inflate(R.layout.fragment_bus_info, container, false); List<Fragment> fragmentList = new ArrayList<>(); markerTitle = (TextView) v.findViewById(R.id.mainName); desc1View = (TextView) v.findViewById(R.id.desc1); desc2View = (TextView) v.findViewById(R.id.desc2); dist = (TextView) v.findViewById(R.id.dist); String category = getArguments().getString("title"); String desc1 = getArguments().getString("desc1"); String desc2 = getArguments().getString("desc2"); String distance = getArguments().getString("distance"); icon = (ImageView) v.findViewById(R.id.icon); markerTitle.setText(category); desc1View.setText(desc1); desc2View.setText(desc2); dist.setText(distance); if (category != null) { switch (category) { case MapIconCategories.MICROWAVE: icon.setImageResource(R.drawable.microwave_map_icon); markerTitle.setTextColor(getResources().getColor(R.color.orange)); break; case MapIconCategories.WATER_FOUNTAIN: icon.setImageResource(R.drawable.waterbottle_map_icon); markerTitle.setTextColor(getResources().getColor(R.color.aqua)); break; case MapIconCategories.NAP_POD: icon.setImageResource(R.drawable.sleeppod_map_icon); markerTitle.setTextColor(getResources().getColor(R.color.pink)); break; case MapIconCategories.FORD_GO_BIKE: icon.setImageResource(R.drawable.bike_icon); markerTitle.setTextColor(getResources().getColor(R.color.bike_blue)); break; case MapIconCategories.PRINTER: icon.setImageResource(R.drawable.printer_icon); markerTitle.setTextColor(getResources().getColor(R.color.printer_green)); break; case MapIconCategories.MENTAL_HEALTH: icon.setImageResource(R.drawable.mental_health_icon); markerTitle.setTextColor(getResources().getColor(R.color.mental_health_yellow)); break; } } return v; }