Android 如何获取坐标并自动将其添加到 link

Android how can I get coordinates and add it to link automatically

我正在开发一个整理地址的应用程序,我想实现以下目标:

当我点击添加地址按钮时,会出现两个文本框,NameLink。我希望 Link 文本框自动获取当前位置并将坐标添加到此 URL:

http://maps.google.com/maps?q=

例如这是坐标27.123456,49.123456所以最后的结果会是这样的:

http://maps.google.com/maps?q=27.123456,49.123456

我搜索了几个小时,但我所能做的就是获取当前位置坐标。所以如果有人能帮助我,我将非常感激。

*** 更新这是现在的问题:

public void buildLink(float textLatt, float textLot) {
return String.format("http://maps.google.com/maps?q=%f,%f", textLatt, textLot);
}

如果您有坐标,它应该是一个简单的字符串连接并在编辑文本上设置值。你可以做类似的事情(伪代码)

EditText et = findView(R.id.mylink)
et.setText(buildLink(lat, long))

-

void buildLink(float lat, float long){
    return String.format("http://maps.google.com/maps?q=%f,%f", lat,long)
}
txtmylink.setText(
    String.valueOf("http://maps.google.com/maps?q=") + 
    String.valueOf(mLastLocation.getLatitude()) +
    String.valueOf(",") + 
    String.valueOf(mLastLocation.getLongitude()));