无法在Android Project中重新启动类PropertyInfo的setName,setValue,setType方法

时间:2014-10-09 13:49:38

标签: android android-ksoap2

PropertyInfo celsiusPI = new PropertyInfo();
celsiusPI.setName("Celcius");
celsiusPI.setValue(celsius);
celsiusPI.setType(double.class);
request.addProperty(celsiusPI);

我在项目中使用ksoap2-android-full-2.1.2

1 个答案:

答案 0 :(得分:0)

如果Celcius是一个类,那么使用double.class的celsius.getClass()。

这就是我在KSOAP-2 requset中实现ComplexClass的方法。

    //Complex-type class implementation
                    getPendingAmountInfo pendingAmountInfo = new getPendingAmountInfo();

                    pendingAmountInfo.altCustomerId = altCustId;
                    pendingAmountInfo.authToken = authToken;
                    pendingAmountInfo.imei = LoginActivity.imeiNo;

                    PropertyInfo pendingAmtproperty = new PropertyInfo();
                    pendingAmtproperty.setName("pendingAmountInfo");
                    pendingAmtproperty.setValue(pendingAmountInfo);
                    pendingAmtproperty.setType(pendingAmountInfo.getClass());

//Creating Soap request object
                SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
                request.addProperty(pendingAmtproperty);

如果你的celcius是一个复杂的类,你必须像我上面提到的那样。

谢谢:)