1

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

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 { ;({
4

1 回答 1

3

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

于 2012-10-08T21:17:57.083 回答