Launch MapActivity from regular Activity


Last Updated:

  1. kryten

    kryten Member This Topic's Starter

    Joined:
    Jun 5, 2010
    Messages:
    12
    Likes Received:
    0
    I'm trying to launch a MapActivity Class from an Activity Class.
    Here's the Errors I'm seeing in LogCat when I'm starting up the app - the app doesn't actually crash until I click the button to launch the MapActivity. I read where one person had this problem that turned out to be caused by using an emulator version that didn't match the app target version, but I verified that the emulator does match the target version.

    06-26 23:37:56.628: WARN/dalvikvm(287): Unable to resolve superclass of Lcom/ripleyapp/FindUs; (30)
    06-26 23:37:56.638: WARN/dalvikvm(287): Link of class 'Lcom/ripleyapp/FindUs;' failed
    06-26 23:37:56.648: ERROR/dalvikvm(287): Could not find class 'com.ripleyapp.FindUs', referenced from method com.ripleyapp.ripleyapp.startGPS

    Here's the referenced startGPS method:

    privatevoid startGPS(){

    final Intent intent = new Intent(ripleyapp.this, FindUs.class);
    startActivity(intent);
    }
     

    Advertisement
  2. dmitriyk

    dmitriyk Active Member

    Joined:
    Apr 17, 2010
    Messages:
    44
    Likes Received:
    10
    Try referencing the class in the Intent constructor using its fully qualified name or at least make sure that the namespace is correct. It looks like the class you're trying to launch (i.e. FindUs) can't be located.
     
  3. kryten

    kryten Member This Topic's Starter

    Joined:
    Jun 5, 2010
    Messages:
    12
    Likes Received:
    0

    Just tried that, but still...

    final Intent intent = new Intent(ripleyapp.this, com.ripleyapp.FindUs.class);

    06-27 21:16:02.466: WARN/dalvikvm(285): Unable to resolve superclass of Lcom/ripleyapp/FindUs; (30)
    06-27 21:16:02.476: WARN/dalvikvm(285): Link of class 'Lcom/ripleyapp/FindUs;' failed
    06-27 21:16:02.476: ERROR/dalvikvm(285): Could not find class 'com.ripleyapp.FindUs', referenced from method com.ripleyapp.ripleyapp.startGPS
    06-27 21:16:02.496: WARN/dalvikvm(285): VFY: unable to resolve const-class 35 (Lcom/ripleyapp/FindUs;) in Lcom/ripleyapp/ripleyapp;


    Another note - If I change the class so that it extends Activity instead of MapActivity, I don't get that error (but of course, I can't use it to display a map then)
     
  4. kryten

    kryten Member This Topic's Starter

    Joined:
    Jun 5, 2010
    Messages:
    12
    Likes Received:
    0
    I found a solution - You simply make that regular activity a mapactivity. That's it. You have to add an unimplemented method along with that of course, but you don't have to actually add a mapview to the layout, just change "extends Activity" to "extends MapActivity". I guess that's why no one has answered the question because the solution is so obvious. I had tried this once and failed, but forgot to put the " <uses-library android:name="com.google.android.maps" />" in the manifest
     
  5. dimovdaniel

    dimovdaniel New Member

    Joined:
    Nov 13, 2010
    Messages:
    1
    Likes Received:
    0
    Just move the <uses-library android:name="com.google.android.maps" /> UP int he mainfest file and every think will work fine
     

Share This Page

Loading...