1. Gewinne jetzt ein UMiDIGI C Note - alle Informationen findest du hier!!
  1. daroxxxer, 17.08.2011 #1
    daroxxxer

    daroxxxer Threadstarter Neuer Benutzer

    Hallo,

    ich bin gerade dabei mich in die programmierung von Android "reinzufuchsen". Ich habe im Moment noch das Problem Fehler zu deuten.

    Ich hoffe Jemand von euch könnte mir sagen wo der Fehler liegt.

    Hier einmal der Code-Schnippsel, welcher wohl den Fehler verursacht:

    Code:
        private void getLongLat(){
            final Geocoder geoCoder = new Geocoder(AndroidGPSTestActivity.this, Locale.GERMAN);
            try{
                List <Address> addresses = geoCoder.getFromLocationName("Kassel", 1);
                if(addresses.size() > 0){
                    GeoPoint p = new GeoPoint(
                            (int) (addresses.get(0).getLatitude() * 1E6), 
                            (int) (addresses.get(0).getLongitude() * 1E6));
    
                    Toast.makeText(AndroidGPSTestActivity.this, p.toString(), Toast.LENGTH_LONG).show();
                }else{
                    Toast.makeText(AndroidGPSTestActivity.this, "Kein Ort!", Toast.LENGTH_LONG).show();
                }
            } catch(Exception e){
                Toast.makeText(AndroidGPSTestActivity.this, "Fehler", Toast.LENGTH_LONG).show();
            }            
        }
    Der Fehler:

    Code:
    08-17 08:54:02.653: ERROR/AndroidRuntime(780): Uncaught handler: thread main exiting due to uncaught exception
    08-17 08:54:02.673: ERROR/AndroidRuntime(780): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.javacodegeeks.android.lbs/com.javacodegeeks.android.lbs.AndroidGPSTestActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class java.lang.reflect.Constructor
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at android.app.ActivityThread.access$1800(ActivityThread.java:112)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at android.os.Handler.dispatchMessage(Handler.java:99)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at android.os.Looper.loop(Looper.java:123)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at android.app.ActivityThread.main(ActivityThread.java:3948)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at java.lang.reflect.Method.invokeNative(Native Method)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at java.lang.reflect.Method.invoke(Method.java:521)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at dalvik.system.NativeStart.main(Native Method)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780): Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class java.lang.reflect.Constructor
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at android.view.LayoutInflater.createView(LayoutInflater.java:512)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:564)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:617)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:309)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at android.app.Activity.setContentView(Activity.java:1626)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at com.javacodegeeks.android.lbs.AndroidGPSTestActivity.onCreate(AndroidGPSTestActivity.java:36)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     ... 11 more
    08-17 08:54:02.673: ERROR/AndroidRuntime(780): Caused by: java.lang.reflect.InvocationTargetException
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at com.google.android.maps.MapView.<init>(MapView.java:237)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at java.lang.reflect.Constructor.constructNative(Native Method)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at android.view.LayoutInflater.createView(LayoutInflater.java:499)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     ... 21 more
    08-17 08:54:02.673: ERROR/AndroidRuntime(780): Caused by: java.lang.IllegalArgumentException: MapViews can only be created inside instances of MapActivity.
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at com.google.android.maps.MapView.<init>(MapView.java:281)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     at com.google.android.maps.MapView.<init>(MapView.java:254)
    08-17 08:54:02.673: ERROR/AndroidRuntime(780):     ... 25 more
    
    Wäre sehr dankbar wenn mir Jemand helfen könnte :)

    Viele Grüße
    Michael
     
  2. the_alien, 17.08.2011 #2
    the_alien

    the_alien Android-Lexikon

    Naja, die XML die du in der AndroidGPSTestActivity in der Methode onCreate in Zeile 36 setzt kann nicht eingelesen werden weil sie in Zeile 13 einen Fehler hat.
     
    daroxxxer gefällt das.
  3. daroxxxer, 17.08.2011 #3
    daroxxxer

    daroxxxer Threadstarter Neuer Benutzer

    Danke.

    Hatte einen Fehler in der Main.XML :)
     
  4. the_alien, 17.08.2011 #4
    the_alien

    the_alien Android-Lexikon

    Danke ist unten rechts... ;)
     
    daroxxxer gefällt das.
Du betrachtest das Thema "The application has stopped unexpectedly" im Forum "Android App Entwicklung",