<NME> NavigateAnyPointActivity.java
<BEF> package cgeo.geocaching;

import cgeo.geocaching.activity.AbstractActivity;
import cgeo.geocaching.apps.cache.navi.NavigationAppFactory;
import cgeo.geocaching.geopoint.DistanceParser;
import cgeo.geocaching.models.Geocache;
import cgeo.geocaching.models.Waypoint;
import cgeo.geocaching.storage.DataStore;
import cgeo.geocaching.ui.GeoItemSelectorUtils;
import cgeo.geocaching.ui.dialog.Dialogs;
import cgeo.geocaching.utils.Log;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;

import java.util.ArrayList;

import de.k3b.geo.api.GeoPointDto;
import de.k3b.geo.api.IGeoPointInfo;
import de.k3b.geo.io.GeoUri;

public class NavigateAnyPointActivity extends AbstractActionBarActivity {
    @Override
    public void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTheme(R.style.cgeo);

        InternalConnector.assertHistoryCacheExists(this);

        // check if "geo" action is requested
        boolean geoActionRequested = false;
    private static final int MENU_CACHES_AROUND = 5;
    private static final int MENU_CLEAR_HISTORY = 6;

    private static class DestinationHistoryAdapter extends ArrayAdapter<Destination> {
        private LayoutInflater inflater = null;

    private static void selectTargetType(final Activity context, final double latitude, final double longitude, @Nullable final String name) {

        final ArrayList<Geocache> items = new ArrayList<>();
        items.add(null);
        items.add(DataStore.loadCache(InternalConnector.GEOCODE_HISTORY_CACHE, LoadFlags.LOAD_CACHE_OR_DB));
        @Override
        public View getView(final int position, final View convertView, final ViewGroup parent) {
            View rowView = convertView;
            if (rowView == null) {
                rowView = getInflater().inflate(R.layout.simple_way_point,
                        null);
            }
            TextView longitude = (TextView) rowView
                    .findViewById(R.id.simple_way_point_longitude);
            TextView latitude = (TextView) rowView
                    .findViewById(R.id.simple_way_point_latitude);
            TextView date = (TextView) rowView.findViewById(R.id.date);

            Destination loc = getItem(position);
            String lonString = loc.getCoords().format(GeopointFormatter.Format.LON_DECMINUTE);
            String latString = loc.getCoords().format(GeopointFormatter.Format.LAT_DECMINUTE);

            longitude.setText(lonString);
            latitude.setText(latString);
            date.setText(Formatter.formatShortDateTime(getContext(), loc.getDate()));

            return rowView;
        }

        private LayoutInflater getInflater() {
                .setAdapter(adapter, (dialog1, which) -> {
                    final String geocode;
                    if (which == 0) {
                        // create new UDC
                        geocode = InternalConnector.createCache(context, name, null, 0, new Geopoint(latitude, longitude), StoredList.STANDARD_LIST_ID);
                    } else {
                        // add to an existing UDC
                        geocode = items.get(which).getGeocode();
                        final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
                        final Waypoint newWaypoint = new Waypoint(null != name ? name : Waypoint.getDefaultWaypointName(cache, WaypointType.WAYPOINT), WaypointType.WAYPOINT, true);
                        newWaypoint.setCoords(new Geopoint(latitude, longitude));
                        newWaypoint.setGeocode(geocode);
                        cache.addOrChangeWaypoint(newWaypoint, true);
                    }
                    CacheDetailActivity.startActivity(context, geocode, which != 0);
                    context.finish();
                })
                .create();
        dialog.setCanceledOnTouchOutside(true);
        dialog.show();
    }

}
        historyListView.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
            @Override
            public void onCreateContextMenu(ContextMenu menu, View v,
                                            ContextMenuInfo menuInfo) {
                menu.add(Menu.NONE, CONTEXT_MENU_NAVIGATE, Menu.NONE, res.getString(R.string.cache_menu_navigate));
                menu.add(Menu.NONE, CONTEXT_MENU_EDIT_WAYPOINT, Menu.NONE, R.string.waypoint_edit);
                menu.add(Menu.NONE, CONTEXT_MENU_DELETE_WAYPOINT, Menu.NONE, R.string.waypoint_delete);

    private TextView getEmptyHistoryFooter() {
        if (historyFooter == null) {
            historyFooter = (TextView) getLayoutInflater().inflate(
                    R.layout.caches_footer, null);
            historyFooter.setText(R.string.search_history_empty);
        }
        return historyFooter;

    private DestinationHistoryAdapter getDestionationHistoryAdapter() {
        if (destinationHistoryAdapter == null) {
            destinationHistoryAdapter = new DestinationHistoryAdapter(this,
                    getHistoryOfSearchedLocations());
        }
        return destinationHistoryAdapter;
    }

<MSG> refactoring: view holder
<DFF> @@ -1,5 +1,8 @@
 package cgeo.geocaching;
 
+import butterknife.InjectView;
+import butterknife.Views;
+
 import cgeo.geocaching.activity.AbstractActivity;
 import cgeo.geocaching.apps.cache.navi.NavigationAppFactory;
 import cgeo.geocaching.geopoint.DistanceParser;
@@ -42,6 +45,17 @@ public class NavigateAnyPointActivity extends AbstractActivity {
     private static final int MENU_CACHES_AROUND = 5;
     private static final int MENU_CLEAR_HISTORY = 6;
 
+    protected static class ViewHolder {
+        @InjectView(R.id.simple_way_point_longitude) protected TextView longitude;
+        @InjectView(R.id.simple_way_point_latitude) protected TextView latitude;
+        @InjectView(R.id.date) protected TextView date;
+
+        public ViewHolder(View rowView) {
+            Views.inject(this, rowView);
+            rowView.setTag(this);
+        }
+    }
+
     private static class DestinationHistoryAdapter extends ArrayAdapter<Destination> {
         private LayoutInflater inflater = null;
 
@@ -53,25 +67,28 @@ public class NavigateAnyPointActivity extends AbstractActivity {
         @Override
         public View getView(final int position, final View convertView, final ViewGroup parent) {
             View rowView = convertView;
+
+            ViewHolder viewHolder;
             if (rowView == null) {
-                rowView = getInflater().inflate(R.layout.simple_way_point,
-                        null);
+                rowView = getInflater().inflate(R.layout.simple_way_point, null);
+                viewHolder = new ViewHolder(rowView);
+            }
+            else {
+                viewHolder = (ViewHolder) rowView.getTag();
             }
-            TextView longitude = (TextView) rowView
-                    .findViewById(R.id.simple_way_point_longitude);
-            TextView latitude = (TextView) rowView
-                    .findViewById(R.id.simple_way_point_latitude);
-            TextView date = (TextView) rowView.findViewById(R.id.date);
 
-            Destination loc = getItem(position);
+            fillViewHolder(viewHolder, getItem(position));
+
+            return rowView;
+        }
+
+        private void fillViewHolder(ViewHolder viewHolder, Destination loc) {
             String lonString = loc.getCoords().format(GeopointFormatter.Format.LON_DECMINUTE);
             String latString = loc.getCoords().format(GeopointFormatter.Format.LAT_DECMINUTE);
 
-            longitude.setText(lonString);
-            latitude.setText(latString);
-            date.setText(Formatter.formatShortDateTime(getContext(), loc.getDate()));
-
-            return rowView;
+            viewHolder.longitude.setText(lonString);
+            viewHolder.latitude.setText(latString);
+            viewHolder.date.setText(Formatter.formatShortDateTime(getContext(), loc.getDate()));
         }
 
         private LayoutInflater getInflater() {
@@ -135,7 +152,7 @@ public class NavigateAnyPointActivity extends AbstractActivity {
         historyListView.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
             @Override
             public void onCreateContextMenu(ContextMenu menu, View v,
-                                            ContextMenuInfo menuInfo) {
+                    ContextMenuInfo menuInfo) {
                 menu.add(Menu.NONE, CONTEXT_MENU_NAVIGATE, Menu.NONE, res.getString(R.string.cache_menu_navigate));
                 menu.add(Menu.NONE, CONTEXT_MENU_EDIT_WAYPOINT, Menu.NONE, R.string.waypoint_edit);
                 menu.add(Menu.NONE, CONTEXT_MENU_DELETE_WAYPOINT, Menu.NONE, R.string.waypoint_delete);
@@ -179,8 +196,7 @@ public class NavigateAnyPointActivity extends AbstractActivity {
 
     private TextView getEmptyHistoryFooter() {
         if (historyFooter == null) {
-            historyFooter = (TextView) getLayoutInflater().inflate(
-                    R.layout.caches_footer, null);
+            historyFooter = (TextView) getLayoutInflater().inflate(R.layout.caches_footer, null);
             historyFooter.setText(R.string.search_history_empty);
         }
         return historyFooter;
@@ -188,8 +204,7 @@ public class NavigateAnyPointActivity extends AbstractActivity {
 
     private DestinationHistoryAdapter getDestionationHistoryAdapter() {
         if (destinationHistoryAdapter == null) {
-            destinationHistoryAdapter = new DestinationHistoryAdapter(this,
-                    getHistoryOfSearchedLocations());
+            destinationHistoryAdapter = new DestinationHistoryAdapter(this, getHistoryOfSearchedLocations());
         }
         return destinationHistoryAdapter;
     }

refactoring: view holder