开发者

Problem in launching Google MapActivity

开发者 https://www.devze.com 2023-03-14 17:54 出处:网络
I am trying to launch a MapActivity from Activity using intent. Following is how i defined my MapActivity

I am trying to launch a MapActivity from Activity using intent.

Following is how i defined my MapActivity

public class googlemap extends MapActivity 
{
   /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
       ... //logic code
    }
}

I am trying to launch this MapActivity from Activty using following Intent:

//Viewreport is the Activity name
intent = new Intent(Viewreport.this,googlemap.class);
startActivity(intent);

It gives me following error in logcat:

06-23 15:48:22.812: ERROR/AndroidRuntime(295): FATAL EXCEPTION: main
06-23 15:48:22.812: ERROR/AndroidRuntime(295): java.lang.NoClassDefFoundError: pam.com.pampkg.googlemap
06-23 15:48:22.812: ERROR/AndroidRuntime(295):     at pam.com.pampkg.Viewreport$btnmaplist.onClick(Viewreport.java:61)
06-23 15:48:22.812: ERROR/AndroidRuntime(295):     at android.view.View.performClick(View.java:2408)
06-23 15:48:22.812: ERROR/AndroidRuntime(295):     at android.view.View$PerformClick.run(View.java:8816)
06-23 15:48:22.812: ERROR/AndroidRuntime(295):     at android.os.Handler.handleCallback(Handler.java:587)
06-23 15:48:22.812: ERROR/AndroidRuntime(295):     at android.os.Handler.dispatchMessage(Handler.java:92)
06-23 15:48:22.812: ERROR/AndroidRuntime(295):     at android.os.Lo开发者_C百科oper.loop(Looper.java:123)
06-23 15:48:22.812: ERROR/AndroidRuntime(295):     at android.app.ActivityThread.main(ActivityThread.java:4627)
06-23 15:48:22.812: ERROR/AndroidRuntime(295):     at java.lang.reflect.Method.invokeNative(Native Method)
06-23 15:48:22.812: ERROR/AndroidRuntime(295):     at java.lang.reflect.Method.invoke(Method.java:521)
06-23 15:48:22.812: ERROR/AndroidRuntime(295):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-23 15:48:22.812: ERROR/AndroidRuntime(295):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-23 15:48:22.812: ERROR/AndroidRuntime(295):     at dalvik.system.NativeStart.main(Native Method)

Also, I have added following to the Manifest.xml file:

<activity android:name=".googlemap" android:label="@string/app_name">
   <intent-filter>
      <action android:name="android.intent.action.MAIN" />                
      <category android:name="android.intent.category.DEFAULT" />
   </intent-filter>
</activity>

Could someone tell what I am missing here.

Thanks!


Add uses-permission android:name="android.permission.INTERNET" in the manifest file


Have you tried looking at this: Cannot resolve MapActivity class on Android?


I just re installed the android sdk and it worked fine. Thanks everyone for help and suggestions!

0

精彩评论

暂无评论...
验证码 换一张
取 消