1. Download our Official Android App: Forums for Android!

Apps Launch MapActivity from regular Activity

Discussion in 'Android Development' started by kryten, Jun 26, 2010.

  1. kryten

    kryten Newbie
    Thread Starter
    Rank:
    None
    Points:
    15
    Posts:
    12
    Joined:
    Jun 5, 2010

    Jun 5, 2010
    12
    0
    15
    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 Member
    Rank:
    None
    Points:
    18
    Posts:
    44
    Joined:
    Apr 17, 2010

    Apr 17, 2010
    44
    10
    18
    Software Developer
    Salt Lake City, UT
    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 Newbie
    Thread Starter
    Rank:
    None
    Points:
    15
    Posts:
    12
    Joined:
    Jun 5, 2010

    Jun 5, 2010
    12
    0
    15

    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 Newbie
    Thread Starter
    Rank:
    None
    Points:
    15
    Posts:
    12
    Joined:
    Jun 5, 2010

    Jun 5, 2010
    12
    0
    15
    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 Lurker
    Rank:
    None
    Points:
    5
    Posts:
    1
    Joined:
    Nov 13, 2010

    Nov 13, 2010
    1
    0
    5
    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...