gpt4 book ai didi

android - geocoder.getfromlocationname 返回服务不可用

转载 作者:行者123 更新时间:2023-11-29 18:07:18 27 4
gpt4 key购买 nike

我的手机(不是模拟器)上有这个奇怪的错误。我写了一个代码,一个带有编辑文本的按钮,用于导航到输入的第一个结果。它工作了几天,当我继续开发它时,它突然停止工作了。奇怪的是我安装了一个早期版本但它没有用。从那以后,特定的代码部分没有改变!另外,我在另一部手机上安装了最新版本,但突然之间也无法使用。我不知道如何解决它,也不明白为什么会出现此错误。为什么它以前工作过却突然说服务不可用?这是代码:

configure Search button//Button btn_search = (Button)findViewById(R.id.map_ ;(search_button if(!came_from.matches(" (("FollowLocation } ;(btn_search.setEnabled(false { btn_search.setOnClickListener( } ()new OnClickListener } (public void onClick(View v final AlertDialog.Builder ;(alert = new AlertDialog.Builder(context final EditText input = new ;(EditText(context input.setHint("Enter ;("Address input.setImeOptions( ;(EditorInfo.IME_ACTION_DONE ;(alert.setView(input alert.setPositiveButton("OK", } ()new DialogInterface.OnClickListener public void onClick(DialogInterface dialog, int } (whichButton String value = ;()input.getText().toString().trim } try Geocoder geocoder =

Geocoder(getApplicationContext(), ;(Locale.ENGLISH List<Address> results

;(geocoder.getFromLocationName(value, 1

} (if (results.size() == 0

AlertDialog.Builder builder2 = new ;(AlertDialog.Builder(context

builder2.setMessage("No Address Found, ("Please Try Again

(setCancelable(true.

setNegativeButton("OK", new. } ()DialogInterface.OnClickListener public } (void onClick(DialogInterface dialog, int id

;()dialog.cancel { ({ ;()show. { else } Address ;(address = results.get(0 GeoPoint p = (new GeoPoint((int address.getLatitude() * 1E6), (int)) ;(((address.getLongitude() * 1E6 gMapView = ;((MapView) findViewById(R.id.myGMap mc = ;()gMapView.getController

;(mc.setZoom(18

;(mc.animateTo(p

remove//previous overlays and put this location as circle

;()gMapView.getOverlays().clear Add a //

MyLocationOverlay circleOverlay = new ;()MyLocationOverlay

;circleOverlay.circle=true list = ;()gMapView.getOverlays

;(list.add(circleOverlay {

} (catch (Exception e {

AlertDialog.Builder builder2 = new ;(AlertDialog.Builder(context

builder2.setMessage("Error. Please check

(".internet connection

(setCancelable(true.

setNegativeButton("OK", new. } ()DialogInterface.OnClickListener public } (void onClick(DialogInterface dialog, int id

;()dialog.cancel { ({ ;()show. {

{ ;({ alert.setNegativeButton(" Cancel", new } ()DialogInterface.OnClickListener public void onClick(DialogInterface dialog, int } (whichButton ;()dialog.cancel { ;({ ;()alert.show { ;({

最佳答案

我的问题的答案是重启我的手机。

关于android - geocoder.getfromlocationname 返回服务不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12740443/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com