missing return statement when I run my app in Android Studio

geol

I'm trying to write an app where the user clicks on the marker and starts the camera activity. I've coded this but it does not work, what can I do? When I try to run this app in Android Studio, I get 2 errors :

Error: missing return statement

And

Error:Execution failed for task ':app:compileDebugJavaWithJavac'. Compilation failed; see the compiler error output for details.

I've tried to search on Google, but I couldn't find the solution. Here is my code :

public class MapsActivity extends FragmentActivity implements OnMapReadyCallback, GoogleMap.OnMarkerClickListener {

    private GoogleMap mMap1, mMap2;

    //Other methods removed

    @Override
    public boolean onMarkerClick(final Marker marker){
        if (marker.equals(mMap1)) {
            Intent intent = new Intent(MapsActivity.this, CameraView.class);
            startActivity(intent);
        }
    }
}
user6490462

If you already see the marker on the map then your onMarkerClick() should get their arguments :

@Override
public boolean onMarkerClick(Marker marker) {

    if (marker.equals(marker))
    {
        Intent intent = new Intent(MapsActivity.this, CameraView.class) ;

        startActivity(intent);

    }
    return false;

}

return statement is false indeed.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related