我findViewById拋出錯誤,說它還沒有被定義,它要求我創建一個函數。我該怎麼辦?我findViewByID thowing錯誤?
public void geoLocate(View v) throws IOException {
hideSoftKeyboard(v);
EditText et = (EditText) findViewById(R.id.editText1);
String location = et.getText().toString();
Geocoder gc = new Geocoder(context);
List<Address> list = gc.getFromLocationName(location, 1);
Address add = list.get(0);
String locality = add.getLocality();
Toast.makeText(context, locality, Toast.LENGTH_LONG).show();
double lat = add.getLatitude();
double lng = add.getLatitude();
gotoLocation(lat, lng, DEFAULTZOOM);
MarkerOptions markerOptions = new MarkerOptions().title(locality).position(new LatLng(lat,lng));
mMap.addMarker(markerOptions);
}
安置自己的logcat錯誤 –
什麼課這是什麼? –
這個方法在'Activity'裏面嗎? – PPartisan