Methods 类型日志中的方法d(String,String)不适用于参数(String,double)

Methods 类型日志中的方法d(String,String)不适用于参数(String,double),methods,double,Methods,Double,我正在做一个基于位置的android项目…但是它显示了一些错误 类型日志中的方法dString,String不适用于参数String,double 资料来源: public void onLocationChanged(Location paramLocation) { this.lati = Double.valueOf(paramLocation.getLatitude()); this.longi = Double.va

我正在做一个基于位置的android项目…但是它显示了一些错误

类型日志中的方法dString,String不适用于参数String,double

资料来源:

 public void onLocationChanged(Location paramLocation)
          {
            this.lati = Double.valueOf(paramLocation.getLatitude());
            this.longi = Double.valueOf(paramLocation.getLongitude());
            if (this.c.moveToFirst()) {
              do
              {
                double d1 = this.longi.doubleValue() - Double.parseDouble(this.c.getString(3));
                double d2 = 1000.0D * (1.609344D * (1.1515D * (60.0D * rad2deg(Math.acos(Math.sin(deg2rad(this.lati.doubleValue())) * Math.sin(deg2rad(Double.parseDouble(this.c.getString(2)))) + Math.cos(deg2rad(this.lati.doubleValue())) * Math.cos(deg2rad(Double.parseDouble(this.c.getString(2)))) * Math.cos(deg2rad(d1)))))));
                if ((d2 >= 0.0D) && (d2 <= 11.0D)) {
                  profilematching(this.c.getString(1));
                }
                //Log.d("distance", d2);//error in this line (.d)
              } while (this.c.moveToNext());
            }
          }

Log.d似乎接受2个字符串作为参数,但您提供了一个字符串和一个双精度,所以Java抱怨

首先需要将d2转换为字符串

请尝试将String.valueOfd2作为参数,而不是将双精度d2首先转换为String。这个错误准确地解释了问题。