Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/358.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 确定天气用户输入的GPS坐标或街道地址_Java_Android - Fatal编程技术网

Java 确定天气用户输入的GPS坐标或街道地址

Java 确定天气用户输入的GPS坐标或街道地址,java,android,Java,Android,我正在尝试使用谷歌地图从我的应用程序中获取方向 用户可以输入地址或GPS坐标,然后当他们点击一个按钮时,我使用intent调用google maps应用程序,然后将用户输入的内容传递给它,以便google maps可以为他们提供方向 下面显示了从用户现在所在的位置到下面显示的GPS坐标的方向 Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/m

我正在尝试使用谷歌地图从我的应用程序中获取方向

用户可以输入地址或GPS坐标,然后当他们点击一个按钮时,我使用intent调用google maps应用程序,然后将用户输入的内容传递给它,以便google maps可以为他们提供方向

下面显示了从用户现在所在的位置到下面显示的GPS坐标的方向

Intent intent = new Intent(android.content.Intent.ACTION_VIEW, 
    Uri.parse("http://maps.google.com/maps?daddr=20.543,45.345"));
startActivity(intent);

但谷歌地图API似乎需要知道天气才能导航到地址或坐标,我如何确定用户键入的是街道地址还是坐标,以便正确格式化意图,或者我可以将他们键入的任何内容传递给google maps,它就会计算出来吗?

您可以使用
正则表达式检查用户是否输入了坐标或街道名称