我的应用程序使用GeoCoder
不断返回字符串为true。这里是我的代码。Geocoder始终返回true
public boolean address(){
Geocoder geoCoder =
new Geocoder
(getBaseContext(), Locale.getDefault());
try {
List<Address> addresses = geoCoder.getFromLocation(LocationManagerHelper.getLatitude()/1E6, LocationManagerHelper.getLongitude()/1E6, 1);
String addes = "";
if (addresses.size() > 0)
{
for (int i=0; i<addresses.get(0).getMaxAddressLineIndex();
i++)
addes += addresses.get(0).getAddressLine(i) + "\n";
}
}
catch (IOException e) {
e.printStackTrace();
}
return true;
}
我将其称为文本视图。
add.append(""+ address()
+ '\n');
它的工作原理有点除了它不显示的地址,改为true
任何一个可以告诉我这是为什么?
谢谢。
因此,请等待:您定义了一个返回“true”的address()方法 - 查看您发布的代码块中右括号之前的最后一行 - 并且您发现令人惊讶的是,当您称其为附加结果到一个'TextView',显示的文本是'true'? –
@Giulio Piancatelli,我确实认为我的回归声明是问题所在。我需要知道什么切换到。 – Christian