本文介绍了错误:构造地质codeR(背景下,区域设置)是未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要得到的城市,但我试着用下面的code和告诉我构造地质codeR(SitesAdapter,区域设置)是未定义,我试着在这个论坛和anothers许多方面和I'not找到合适的解决方案。什么是地球在codeR(语境,语言环境)正确的背景下?
地理codeR:
地理codeR地理codeR;
清单<地址>地址;
地理codeR =新的地缘codeR(SitesAdapter.this,Locale.getDefault());
地址=地理coder.getFromLocation(纬度,经度,1);
串城市= addresses.get(0).getAddressLine(1);
全部code:
公共类SitesAdapter扩展ArrayAdapter< StackSite> { 公共SitesAdapter(上下文CTX,INT textViewResourceId,列表与LT; StackSite>网站){
超(CTX,textViewResourceId,网站);
} @覆盖
公共查看getView(INT POS,查看convertView,父母的ViewGroup){
...
//获取我们的观点参考
TextView的tituloTxt =(TextView中)row.findViewById(R.id.tituloTxt);
TextView的fechaTxt =(TextView中)row.findViewById(R.id.fechaTxt);
TextView的magTxt =(TextView中)row.findViewById(R.id.magTxt);
TextView的depthTxt =(TextView中)row.findViewById(R.id.depthTxt); 字符串stringlat = this.getItem(POS).getLat();
双纬度= Double.parseDouble(stringlat);
字符串stringlng = this.getItem(POS).getLng();
双LNG = Double.parseDouble(stringlng); 字符串dateUTC = this.getItem(POS).getFecha();
字符串stringDepth = this.getItem(POS).getDepth();
双深度= Double.parseDouble(stringDepth); //获取CITY
地理codeR地理codeR;
清单<地址>地址;
地理codeR =新的地缘codeR(SitesAdapter.this,Locale.getDefault());
地址=地理coder.getFromLocation(纬度,经度,1);
串城市= addresses.get(0).getAddressLine(1);
...
}
}
更新
最终code - 第一个解决方案:
地理codeR地理codeR;
清单<地址>地址= NULL;
地理codeR =新的地缘codeR(mContext,Locale.getDefault());
尝试{
地址=地理coder.getFromLocation(纬度,经度,1);
}赶上(IOException异常五){
// TODO自动生成catch块
e.printStackTrace();
}
串城市= addresses.get(0).getAddressLine(1);
logcat的 - 第一个解决方案:
11-07 17:27:32.283:I / StackSites(3808):适配器大小= 327
11-07 17:27:32.303:I / StackSites(3808):getView POS = 0
11-07 17:27:32.383:W / System.err的(3808):java.io.IOException异常:服务不可用
11-07 17:27:32.413:W / System.err的(3808):在android.location.Geo coder.getFromLocation(GEO coder.java:136)
11-07 17:27:32.413:W / System.err的(3808):在com.gestionderiesgos.sismosecuador.SitesAdapter.getView(SitesAdapter.java:101)
11-07 17:27:32.413:W / System.err的(3808):在android.widget.AbsListView.obtainView(AbsListView.java:2271)
11-07 17:27:32.413:W / System.err的(3808):在android.widget.ListView.makeAndAddView(ListView.java:1812)
11-07 17:27:32.413:W / System.err的(3808):在android.widget.ListView.fillDown(ListView.java:687)
11-07 17:27:32.413:W / System.err的(3808):在android.widget.ListView.fillDown(ListView.java:666)
11-07 17:27:32.413:W / System.err的(3808):在android.widget.ListView.fillFromTop(ListView.java:758)
11-07 17:27:32.413:W / System.err的(3808):在android.widget.ListView.layoutChildren(ListView.java:1665)
11-07 17:27:32.413:W / System.err的(3808):在android.widget.AbsListView.onLayout(AbsListView.java:2106)
11-07 17:27:32.413:W / System.err的(3808):在android.view.View.layout(View.java:13879)
11-07 17:27:32.413:W / System.err的(3808):在android.view.ViewGroup.layout(ViewGroup.java:4472)
11-07 17:27:32.413:W / System.err的(3808):在android.widget.RelativeLayout.onLayout(RelativeLayout.java:953)
11-07 17:27:32.413:W / System.err的(3808):在android.view.View.layout(View.java:13879)
11-07 17:27:32.413:W / System.err的(3808):在android.view.ViewGroup.layout(ViewGroup.java:4472)
11-07 17:27:32.413:W / System.err的(3808):在android.widget.FrameLayout.onLayout(FrameLayout.java:461)
11-07 17:27:32.413:W / System.err的(3808):在android.view.View.layout(View.java:13879)
11-07 17:27:32.413:W / System.err的(3808):在android.view.ViewGroup.layout(ViewGroup.java:4472)
11-07 17:27:32.423:W / System.err的(3808):在android.widget.LinearLayout.setChildFrame(LinearLayout.java:1688)
11-07 17:27:32.423:W / System.err的(3808):在android.widget.LinearLayout.layoutVertical(LinearLayout.java:1546)
11-07 17:27:32.423:W / System.err的(3808):在android.widget.LinearLayout.onLayout(LinearLayout.java:1451)
11-07 17:27:32.423:W / System.err的(3808):在android.view.View.layout(View.java:13879)
11-07 17:27:32.423:W / System.err的(3808):在android.view.ViewGroup.layout(ViewGroup.java:4472)
11-07 17:27:32.433:W / System.err的(3808):在android.widget.FrameLayout.onLayout(FrameLayout.java:461)
11-07 17:27:32.433:W / System.err的(3808):在android.view.View.layout(View.java:13879)
11-07 17:27:32.433:W / System.err的(3808):在android.view.ViewGroup.layout(ViewGroup.java:4472)
11-07 17:27:32.433:W / System.err的(3808):在android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1872)
11-07 17:27:32.433:W / System.err的(3808):在android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1693)
11-07 17:27:32.433:W / System.err的(3808):在android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
11-07 17:27:32.443:W / System.err的(3808):在android.view.ViewRootImpl $ TraversalRunnable.run(ViewRootImpl.java:4218)
11-07 17:27:32.443:W / System.err的(3808):在android.view.Choreographer $ CallbackRecord.run(Choreographer.java:725)
11-07 17:27:32.443:W / System.err的(3808):在android.view.Choreographer.doCallbacks(Choreographer.java:555)
11-07 17:27:32.443:W / System.err的(3808):在android.view.Choreographer.doFrame(Choreographer.java:525)
11-07 17:27:32.443:W / System.err的(3808):在android.view.Choreographer $ FrameDisplayEventReceiver.run(Choreographer.java:711)
11-07 17:27:32.443:W / System.err的(3808):在android.os.Handler.handleCallback(Handler.java:615)
11-07 17:27:32.443:W / System.err的(3808):在android.os.Handler.dispatchMessage(Handler.java:92)
11-07 17:27:32.443:W / System.err的(3808):在android.os.Looper.loop(Looper.java:137)
11-07 17:27:32.443:W / System.err的(3808):在android.app.ActivityThread.main(ActivityThread.java:4744)
11-07 17:27:32.443:W / System.err的(3808):在java.lang.reflect.Method.invokeNative(本机方法)
11-07 17:27:32.443:W / System.err的(3808):在java.lang.reflect.Method.invoke(Method.java:511)
11-07 17:27:32.453:W / System.err的(3808):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:786)
11-07 17:27:32.453:W / System.err的(3808):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-07 17:27:32.453:W / System.err的(3808):在dalvik.system.NativeStart.main(本机方法)
11-07 17:27:32.453:D / AndroidRuntime(3808):关闭VM
11-07 17:27:32.453:W / dalvikvm(3808):主题ID = 1:螺纹未捕获的异常(组= 0x41959318)退出
11-07 17:27:32.463:E / AndroidRuntime(3808):致命异常:主要
11-07 17:27:32.463:E / AndroidRuntime(3808):显示java.lang.NullPointerException
11-07 17:27:32.463:E / AndroidRuntime(3808):在com.gestionderiesgos.sismosecuador.SitesAdapter.getView(SitesAdapter.java:106)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.widget.AbsListView.obtainView(AbsListView.java:2271)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.widget.ListView.makeAndAddView(ListView.java:1812)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.widget.ListView.fillDown(ListView.java:687)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.widget.ListView.fillDown(ListView.java:666)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.widget.ListView.fillFromTop(ListView.java:758)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.widget.ListView.layoutChildren(ListView.java:1665)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.widget.AbsListView.onLayout(AbsListView.java:2106)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.view.View.layout(View.java:13879)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.view.ViewGroup.layout(ViewGroup.java:4472)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.widget.RelativeLayout.onLayout(RelativeLayout.java:953)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.view.View.layout(View.java:13879)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.view.ViewGroup.layout(ViewGroup.java:4472)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.widget.FrameLayout.onLayout(FrameLayout.java:461)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.view.View.layout(View.java:13879)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.view.ViewGroup.layout(ViewGroup.java:4472)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.widget.LinearLayout.setChildFrame(LinearLayout.java:1688)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.widget.LinearLayout.layoutVertical(LinearLayout.java:1546)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.widget.LinearLayout.onLayout(LinearLayout.java:1451)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.view.View.layout(View.java:13879)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.view.ViewGroup.layout(ViewGroup.java:4472)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.widget.FrameLayout.onLayout(FrameLayout.java:461)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.view.View.layout(View.java:13879)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.view.ViewGroup.layout(ViewGroup.java:4472)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1872)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1693)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.view.ViewRootImpl $ TraversalRunnable.run(ViewRootImpl.java:4218)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.view.Choreographer $ CallbackRecord.run(Choreographer.java:725)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.view.Choreographer.doCallbacks(Choreographer.java:555)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.view.Choreographer.doFrame(Choreographer.java:525)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.view.Choreographer $ FrameDisplayEventReceiver.run(Choreographer.java:711)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.os.Handler.handleCallback(Handler.java:615)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.os.Handler.dispatchMessage(Handler.java:92)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.os.Looper.loop(Looper.java:137)
11-07 17:27:32.463:E / AndroidRuntime(3808):在android.app.ActivityThread.main(ActivityThread.java:4744)
11-07 17:27:32.463:E / AndroidRuntime(3808):在java.lang.reflect.Method.invokeNative(本机方法)
11-07 17:27:32.463:E / AndroidRuntime(3808):在java.lang.reflect.Method.invoke(Method.java:511)
11-07 17:27:32.463:E / AndroidRuntime(3808):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:786)
11-07 17:27:32.463:E / AndroidRuntime(3808):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-07 17:27:32.463:E / AndroidRuntime(3808):在dalvik.system.NativeStart.main(本机方法)
11-07 17:27:34.875:I /流程(3808):发送信号。 PID:3808 SIG:9
解决方案
我可以解决与code问题:
字符串城市= NULL;
地理codeR GC =新的地缘codeR(mContext,Locale.getDefault());
清单<地址>清单;
尝试{
清单= gc.getFromLocation(纬度,经度,1);
如果(名单= NULL&放大器;!&安培;则为list.size()0){
地址地址= list.get(0);
城市= address.getAdminArea();
}
}赶上(IOException异常五){
// TODO自动生成catch块
e.printStackTrace();
}
您可以检查此。祝你好运
I want to get the city, but I try with the following code and show me "The constructor Geocoder(SitesAdapter, Locale) is undefined", I try many ways in this forum and anothers and I'not find the right solution. What would be the right context in Geocoder(Context, Locale)?.
Geocoder:
Geocoder geocoder;
List<Address> addresses;
geocoder = new Geocoder(SitesAdapter.this, Locale.getDefault());
addresses = geocoder.getFromLocation(lat, lng, 1);
String city= addresses.get(0).getAddressLine(1);
Full code:
public class SitesAdapter extends ArrayAdapter<StackSite> {
public SitesAdapter(Context ctx, int textViewResourceId, List<StackSite> sites) {
super(ctx, textViewResourceId, sites);
}
@Override
public View getView(int pos, View convertView, ViewGroup parent){
...
//Get our View References
TextView tituloTxt = (TextView)row.findViewById(R.id.tituloTxt);
TextView fechaTxt = (TextView)row.findViewById(R.id.fechaTxt);
TextView magTxt = (TextView)row.findViewById(R.id.magTxt);
TextView depthTxt = (TextView)row.findViewById(R.id.depthTxt);
String stringlat = this.getItem(pos).getLat();
Double lat = Double.parseDouble(stringlat);
String stringlng = this.getItem(pos).getLng();
Double lng = Double.parseDouble(stringlng);
String dateUTC = this.getItem(pos).getFecha();
String stringDepth = this.getItem(pos).getDepth();
Double depth = Double.parseDouble(stringDepth);
//GET CITY
Geocoder geocoder;
List<Address> addresses;
geocoder = new Geocoder(SitesAdapter.this, Locale.getDefault());
addresses = geocoder.getFromLocation(lat, lng, 1);
String city= addresses.get(0).getAddressLine(1);
...
}
}
UPDATE Final Code - first solution:
Geocoder geocoder;
List<Address> addresses = null;
geocoder = new Geocoder(mContext, Locale.getDefault());
try {
addresses = geocoder.getFromLocation(lat, lng, 1);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String city= addresses.get(0).getAddressLine(1);
LOGCAT - first solution:
11-07 17:27:32.283: I/StackSites(3808): adapter size = 327
11-07 17:27:32.303: I/StackSites(3808): getView pos = 0
11-07 17:27:32.383: W/System.err(3808): java.io.IOException: Service not Available
11-07 17:27:32.413: W/System.err(3808): at android.location.Geocoder.getFromLocation(Geocoder.java:136)
11-07 17:27:32.413: W/System.err(3808): at com.gestionderiesgos.sismosecuador.SitesAdapter.getView(SitesAdapter.java:101)
11-07 17:27:32.413: W/System.err(3808): at android.widget.AbsListView.obtainView(AbsListView.java:2271)
11-07 17:27:32.413: W/System.err(3808): at android.widget.ListView.makeAndAddView(ListView.java:1812)
11-07 17:27:32.413: W/System.err(3808): at android.widget.ListView.fillDown(ListView.java:687)
11-07 17:27:32.413: W/System.err(3808): at android.widget.ListView.fillDown(ListView.java:666)
11-07 17:27:32.413: W/System.err(3808): at android.widget.ListView.fillFromTop(ListView.java:758)
11-07 17:27:32.413: W/System.err(3808): at android.widget.ListView.layoutChildren(ListView.java:1665)
11-07 17:27:32.413: W/System.err(3808): at android.widget.AbsListView.onLayout(AbsListView.java:2106)
11-07 17:27:32.413: W/System.err(3808): at android.view.View.layout(View.java:13879)
11-07 17:27:32.413: W/System.err(3808): at android.view.ViewGroup.layout(ViewGroup.java:4472)
11-07 17:27:32.413: W/System.err(3808): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:953)
11-07 17:27:32.413: W/System.err(3808): at android.view.View.layout(View.java:13879)
11-07 17:27:32.413: W/System.err(3808): at android.view.ViewGroup.layout(ViewGroup.java:4472)
11-07 17:27:32.413: W/System.err(3808): at android.widget.FrameLayout.onLayout(FrameLayout.java:461)
11-07 17:27:32.413: W/System.err(3808): at android.view.View.layout(View.java:13879)
11-07 17:27:32.413: W/System.err(3808): at android.view.ViewGroup.layout(ViewGroup.java:4472)
11-07 17:27:32.423: W/System.err(3808): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1688)
11-07 17:27:32.423: W/System.err(3808): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1546)
11-07 17:27:32.423: W/System.err(3808): at android.widget.LinearLayout.onLayout(LinearLayout.java:1451)
11-07 17:27:32.423: W/System.err(3808): at android.view.View.layout(View.java:13879)
11-07 17:27:32.423: W/System.err(3808): at android.view.ViewGroup.layout(ViewGroup.java:4472)
11-07 17:27:32.433: W/System.err(3808): at android.widget.FrameLayout.onLayout(FrameLayout.java:461)
11-07 17:27:32.433: W/System.err(3808): at android.view.View.layout(View.java:13879)
11-07 17:27:32.433: W/System.err(3808): at android.view.ViewGroup.layout(ViewGroup.java:4472)
11-07 17:27:32.433: W/System.err(3808): at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1872)
11-07 17:27:32.433: W/System.err(3808): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1693)
11-07 17:27:32.433: W/System.err(3808): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
11-07 17:27:32.443: W/System.err(3808): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4218)
11-07 17:27:32.443: W/System.err(3808): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
11-07 17:27:32.443: W/System.err(3808): at android.view.Choreographer.doCallbacks(Choreographer.java:555)
11-07 17:27:32.443: W/System.err(3808): at android.view.Choreographer.doFrame(Choreographer.java:525)
11-07 17:27:32.443: W/System.err(3808): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
11-07 17:27:32.443: W/System.err(3808): at android.os.Handler.handleCallback(Handler.java:615)
11-07 17:27:32.443: W/System.err(3808): at android.os.Handler.dispatchMessage(Handler.java:92)
11-07 17:27:32.443: W/System.err(3808): at android.os.Looper.loop(Looper.java:137)
11-07 17:27:32.443: W/System.err(3808): at android.app.ActivityThread.main(ActivityThread.java:4744)
11-07 17:27:32.443: W/System.err(3808): at java.lang.reflect.Method.invokeNative(Native Method)
11-07 17:27:32.443: W/System.err(3808): at java.lang.reflect.Method.invoke(Method.java:511)
11-07 17:27:32.453: W/System.err(3808): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
11-07 17:27:32.453: W/System.err(3808): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-07 17:27:32.453: W/System.err(3808): at dalvik.system.NativeStart.main(Native Method)
11-07 17:27:32.453: D/AndroidRuntime(3808): Shutting down VM
11-07 17:27:32.453: W/dalvikvm(3808): threadid=1: thread exiting with uncaught exception (group=0x41959318)
11-07 17:27:32.463: E/AndroidRuntime(3808): FATAL EXCEPTION: main
11-07 17:27:32.463: E/AndroidRuntime(3808): java.lang.NullPointerException
11-07 17:27:32.463: E/AndroidRuntime(3808): at com.gestionderiesgos.sismosecuador.SitesAdapter.getView(SitesAdapter.java:106)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.widget.AbsListView.obtainView(AbsListView.java:2271)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.widget.ListView.makeAndAddView(ListView.java:1812)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.widget.ListView.fillDown(ListView.java:687)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.widget.ListView.fillDown(ListView.java:666)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.widget.ListView.fillFromTop(ListView.java:758)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.widget.ListView.layoutChildren(ListView.java:1665)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.widget.AbsListView.onLayout(AbsListView.java:2106)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.view.View.layout(View.java:13879)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.view.ViewGroup.layout(ViewGroup.java:4472)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:953)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.view.View.layout(View.java:13879)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.view.ViewGroup.layout(ViewGroup.java:4472)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.widget.FrameLayout.onLayout(FrameLayout.java:461)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.view.View.layout(View.java:13879)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.view.ViewGroup.layout(ViewGroup.java:4472)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1688)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1546)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.widget.LinearLayout.onLayout(LinearLayout.java:1451)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.view.View.layout(View.java:13879)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.view.ViewGroup.layout(ViewGroup.java:4472)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.widget.FrameLayout.onLayout(FrameLayout.java:461)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.view.View.layout(View.java:13879)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.view.ViewGroup.layout(ViewGroup.java:4472)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1872)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1693)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4218)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.view.Choreographer.doCallbacks(Choreographer.java:555)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.view.Choreographer.doFrame(Choreographer.java:525)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.os.Handler.handleCallback(Handler.java:615)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.os.Handler.dispatchMessage(Handler.java:92)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.os.Looper.loop(Looper.java:137)
11-07 17:27:32.463: E/AndroidRuntime(3808): at android.app.ActivityThread.main(ActivityThread.java:4744)
11-07 17:27:32.463: E/AndroidRuntime(3808): at java.lang.reflect.Method.invokeNative(Native Method)
11-07 17:27:32.463: E/AndroidRuntime(3808): at java.lang.reflect.Method.invoke(Method.java:511)
11-07 17:27:32.463: E/AndroidRuntime(3808): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
11-07 17:27:32.463: E/AndroidRuntime(3808): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-07 17:27:32.463: E/AndroidRuntime(3808): at dalvik.system.NativeStart.main(Native Method)
11-07 17:27:34.875: I/Process(3808): Sending signal. PID: 3808 SIG: 9
解决方案
I can to resolve problem with that code:
String city = null;
Geocoder gc = new Geocoder(mContext, Locale.getDefault());
List<Address> list;
try {
list = gc.getFromLocation(lat, lng,1);
if (list != null && list.size() > 0) {
Address address = list.get(0);
city = address.getAdminArea();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
You can check this sample . Good luck
这篇关于错误:构造地质codeR(背景下,区域设置)是未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!