开发者

calling a mapactivity from another activity

I get a class not found exception.

I have included the required entry in manifest file. The code in current activity is as follows:

 Intent i = new Intent(MainListingA.this, DrawTheatreMap.class);

        开发者_运维百科    try{
             startActivity(i); 

            }

........

The error I get is as follows:

07-26 23:03:20.259: WARN/dalvikvm(307): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
07-26 23:03:20.397: ERROR/AndroidRuntime(307): FATAL EXCEPTION: main
07-26 23:03:20.397: ERROR/AndroidRuntime(307): java.lang.NoClassDefFoundError: com.mobilo.movie.DrawTheatreMap
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at com.mobilo.movie.MainListingA$1.onItemClick(MainListingA.java:101)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at android.widget.AdapterView.performItemClick(AdapterView.java:284)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at android.widget.ListView.performItemClick(ListView.java:3382)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at android.widget.AbsListView$PerformClick.run(AbsListView.java:1696)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at android.os.Handler.handleCallback(Handler.java:587)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at android.os.Handler.dispatchMessage(Handler.java:92)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at android.os.Looper.loop(Looper.java:123)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at android.app.ActivityThread.main(ActivityThread.java:4627)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at java.lang.reflect.Method.invokeNative(Native Method)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at java.lang.reflect.Method.invoke(Method.java:521)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at dalvik.system.NativeStart.main(Native Method)

Any help is highly appreciated.

On a standalone basis, the same map activity works fine.

Rgds, PP


You might have the uses-library-Tag in the wrong place, at least that was my problem once and the Eclipse / the Google SDK does not complain about that. It has to be under application, different to uses-permission which goes beside the application-Tag.

It should look like this:

<manifest ...>

    <uses-permission android:name="android.permission.INTERNET" />

    <application ...>

        <uses-library android:name="com.google.android.maps" />

    </application>

</manifest>


I usually encounter that error when the application is being run on an emulator that lacks the Google APIs, because Android cannot find the MapActivity class.


Yes putting the using map permission inside of the Application tag fixed it for me in the emulator. v-2.1.1


Simplest answer is just change main activity as to extend MapActivity and add some unimplemented methods there like

@Override
protected boolean isRouteDisplayed() {

}

So u have a normal activity converted into MapActivity but do not add any map views there you are free to use any thing with MapActivity as it has all properties of normal activity it worked for me!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜