Fragment is not abstract and does not override abstract method onLocationChanged(Location) in LocationListener
<p>According to the error message, i am clearly overriding the onLocationchanged method in the main but it keeps saying that you have to implement the method. I know this listener also have more 3 methods. When i try to override those, it says "Method does not override Method from its super class".</p>

<p>Either way i am not able to solve the problem.</p>

<p>here is the Fragment Class.</p>

<pre><code>    package com.example.mudasir.login.fragments;


import android.Manifest;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationManager;
import android.media.audiofx.AudioEffect;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.example.mudasir.login.R;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;

import java.io.IOException;
import java.util.List;


/**
 * A simple {@link Fragment} subclass.
 */
public class LocatorsFragment extends Fragment implements OnMapReadyCallback, View.OnClickListener, LocationListener {

    private GoogleMap mMap;
    private Button btnShowroom;
    private Button btnService;
    private Button btnParts;
    private Button btnGas;
    private Button btnAtm;
    private Button btnSearch;
    private EditText searchQuery;


    Resources stringArrayResource;
    private String[] showroomAddresses;
    private String[] serviceAddresses;
    private String[] partsAddresses;
    private String searchQueryString;
    private android.location.Address address = null;
    List&lt;Address&gt; addressList = null;

    LatLng latLng;
    Geocoder geocoder;
    Marker marker;
    LatLngBounds bounds;
    CameraUpdate cu;
    ProgressDialog dialog;
    boolean flag = false;

    private LocationManager locationManager;
    private LocationListener locationListener;

    public LocatorsFragment() {
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_maps_, container, false);
        locationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE);
        locationListener = new LocationListener() {
            @Override
            public void onLocationChanged(Location location) {
                latLng = new LatLng((double) location.getLatitude(), (double) location.getLongitude());
                marker = mMap.addMarker(new MarkerOptions().position(latLng).title("Pin 1"));
            }
        };


        initUI(view);
        return view;
    }

    private void initUI(View view) {
        btnShowroom = (Button) view.findViewById(R.id.btn_showroom);
        btnService = (Button) view.findViewById(R.id.btn_service);
        btnParts = (Button) view.findViewById(R.id.btn_parts);
        btnGas = (Button) view.findViewById(R.id.btn_gas);
        btnAtm = (Button) view.findViewById(R.id.btn_atm);
        btnSearch = (Button) view.findViewById(R.id.btn_search);
        searchQuery = (EditText) view.findViewById(R.id.editext_search);

        btnShowroom.setOnClickListener(this);
        btnService.setOnClickListener(this);
        btnParts.setOnClickListener(this);
        btnGas.setOnClickListener(this);
        btnAtm.setOnClickListener(this);
        btnSearch.setOnClickListener(this);

        stringArrayResource = getActivity().getResources();
        showroomAddresses = stringArrayResource.getStringArray(R.array.showroom_array);
        serviceAddresses = stringArrayResource.getStringArray(R.array.service_array);
        partsAddresses = stringArrayResource.getStringArray(R.array.parts_array);
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.maps);
        mapFragment.getMapAsync(this);
    }

    @Override
    public void onMapReady(GoogleMap googleMap) {
        mMap = googleMap;




//        if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &amp;&amp; ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
//            // TODO: Consider calling
//            //    ActivityCompat#requestPermissions
//            // here to request the missing permissions, and then overriding
//            //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
//            //                                          int[] grantResults)
//            // to handle the case where the user grants the permission. See the documentation
//            // for ActivityCompat#requestPermissions for more details.
//        }
//        mMap.setMyLocationEnabled(true);
    }

    public void render_Map(String[] addresses,LatLngBounds.Builder builder)
    {
        //mMap.clear();
        geocoder = new Geocoder(getActivity());
        for (int i = 0; i &lt; 5; i++) {
            try {
                addressList = geocoder.getFromLocationName(addresses[i], 1);
            } catch (IOException e) {
                e.printStackTrace();
            }
            address = addressList.get(0);
            latLng = new LatLng(address.getLatitude(), address.getLongitude());
            marker = mMap.addMarker(new MarkerOptions().position(latLng).title(addresses[i]));
            builder.include(marker.getPosition());
        }

        bounds = builder.build();
        int padding = 0;
        cu = CameraUpdateFactory.newLatLngBounds(bounds, padding);
        mMap.animateCamera(cu);
    }
    @Override
    public void onClick(View view) {
        switch(view.getId()) {
            case R.id.btn_showroom:

            //new ShowProgressBar().execute("abc",null,null);

                LatLngBounds.Builder builder1 = new LatLngBounds.Builder();
                render_Map(showroomAddresses,builder1);
                flag = true;
             //   dialog.cancel();
                break;

            case R.id.btn_service:

                LatLngBounds.Builder builder2 = new LatLngBounds.Builder();
                render_Map(serviceAddresses,builder2);
                break;

            case R.id.btn_parts:

                LatLngBounds.Builder builder3 = new LatLngBounds.Builder();
                render_Map(partsAddresses,builder3);
                break;

            case R.id.btn_gas:

                Toast.makeText(getActivity(),getString(R.string.in_progress_text), Toast.LENGTH_SHORT).show();
                break;

            case R.id.btn_atm:

                Toast.makeText(getActivity(),getString(R.string.in_progress_text), Toast.LENGTH_SHORT).show();
                break;

            case R.id.btn_search:

                searchQueryString = searchQuery.getText().toString();
                List&lt;Address&gt; addressList1 = null;

                if(searchQueryString != null &amp;&amp; !searchQueryString.equals(""))
                {
                    geocoder = new Geocoder(getContext());
                    try {
                        addressList1 = geocoder.getFromLocationName(searchQueryString, 1);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    address = addressList1.get(0);
                    latLng = new LatLng(address.getLatitude(), address.getLongitude());
                    mMap.addMarker(new MarkerOptions().position(latLng).title(searchQueryString));
                    mMap.animateCamera(CameraUpdateFactory.newLatLng(latLng));
                }
                else{

                    if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &amp;&amp; ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
                        // TODO: Consider calling
                        //    ActivityCompat#requestPermissions
                        // here to request the missing permissions, and then overriding
                        //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
                        //                                          int[] grantResults)
                        // to handle the case where the user grants the permission. See the documentation
                        // for ActivityCompat#requestPermissions for more details.
                        //return TODO;
                    }
                    locationManager.requestLocationUpdates(locationManager.GPS_PROVIDER, 0, 0, (android.location.LocationListener) locationListener);
                    Toast.makeText(getActivity(),getString(R.string.missing_search_query_error_message), Toast.LENGTH_SHORT).show();}
                break;

        }
    }


    private class ShowProgressBar extends AsyncTask&lt;String, Void, Void&gt; {

        @Override
        protected void onPreExecute() {
            dialog = ProgressDialog.show(getActivity(), "",
                    "Loading. Please wait...", true);
        }

        @Override
        protected Void doInBackground(String... strings) {

        while (!flag == true)
        {
        }
            return null;
        }

        @Override

        protected void onPostExecute(Void aVoid) {
            super.onPostExecute(aVoid);
            dialog.dismiss();

        }
    }
}
</code></pre>

<p>Logcat:</p>

<pre><code>Information:Gradle tasks [:app:assembleDebug]
C:\Users\mudasir\AndroidStudioProjects\BasicSampleApplication\app\src\main\java\com\example\mudasir\login\fragments\LocatorsFragment.java
Error:(45, 8) error: LocatorsFragment is not abstract and does not override abstract method onLocationChanged(Location) in LocationListener
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
&gt; Compilation failed; see the compiler error output for details.
Information:BUILD FAILED
Information:Total time: 6.188 secs
Information:2 errors
Information:0 warnings
Information:See complete output in console
</code></pre>

<p>Stack Trace:</p>

<pre><code>11-18 17:32:17.347 10630-10630/com.example.mudasir.login E/AndroidRuntime: FATAL EXCEPTION: main
                                                                           Process: com.example.mudasir.login, PID: 10630
                                                                           java.lang.ClassCastException: com.example.mudasir.login.fragments.LocatorsFragment$1 cannot be cast to android.location.LocationListener
                                                                               at com.example.mudasir.login.fragments.LocatorsFragment.onClick(LocatorsFragment.java:230)
                                                                               at android.view.View.performClick(View.java:4766)
                                                                               at android.view.View$PerformClick.run(View.java:19683)
                                                                               at android.os.Handler.handleCallback(Handler.java:739)
                                                                               at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                               at android.os.Looper.loop(Looper.java:135)
                                                                               at android.app.ActivityThread.main(ActivityThread.java:5538)
                                                                               at java.lang.reflect.Method.invoke(Native Method)
                                                                               at java.lang.reflect.Method.invoke(Method.java:372)
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
</code></pre>