I am using a loop to add markers to a Google Map. The loop did work before I implemented the if-statements. Why wont it work now? I just dont understand why it wont work, it seems logical?
for(int i=1;i<statoilnumber;i++) {
    String XCord = sharedPreferences.getString("XCord"+i,"0");
    String YCord = sharedPreferences.getString("YCord"+i, "0");
    int Title = sharedPreferences.getInt("Title" + i, 0);
    String Info = sharedPreferences.getString("Info" + i, "0");
    String Icon = sharedPreferences.getString("Icon" + i, "4");
    String realTitle = Integer.toString(Title);
    // Drawing marker on the map
    if(Icon=="4") {
        googleMap.addMarker(new MarkerOptions()
                                            .position(new LatLng(Double.parseDouble(YCord), Double.parseDouble(XCord)))
                                            .title(realTitle + ". Statoil")
                                            .snippet(Info)
                                            .icon(BitmapDescriptorFactory.fromResource(R.drawable.statoil_correct)));
    }
    if(Icon=="1") {
        googleMap.addMarker(new MarkerOptions()
                            .position(new LatLng(Double.parseDouble(YCord), Double.parseDouble(XCord)))
                            .title(realTitle + ". Statoil")
                            .snippet(Info)
                            .icon(BitmapDescriptorFactory.fromResource(R.drawable.approved_scale)));
    }
    if(Icon=="2") {
        googleMap.addMarker(new MarkerOptions()
                            .position(new LatLng(Double.parseDouble(YCord), Double.parseDouble(XCord)))
                            .title(realTitle + ". Statoil")
                            .snippet(Info)
                            .icon(BitmapDescriptorFactory.fromResource(R.drawable.clock_scale)));
    }
    if(Icon=="3") {
        googleMap.addMarker(new MarkerOptions()
                            .position(new LatLng(Double.parseDouble(YCord), Double.parseDouble(XCord)))
                            .title(realTitle + ". Statoil")
                            .snippet(Info)
                            .icon(BitmapDescriptorFactory.fromResource(R.drawable.death_scale)));
    }
}
 
     
    