简体   繁体   English

如何从另一个类调用一个类(mapview扩展mapActivity)?

[英]how do call a class(mapview extending mapActivity) from another class?

I tried doing it by using Intent,but,i seem to get the following error: 11-15 22:40:39.266: ERROR/dalvikvm(1589): Could not find class 'BlobCity.xyz.com.maps', referenced from method BlobCity.xyz.com.BlobCity$sendUserPass.onClick 我尝试通过使用Intent来执行此操作,但是,我似乎收到以下错误:11-15 22:40:39.266:ERROR / dalvikvm(1589):找不到类'BlobCity.xyz.com.maps',引用自方法BlobCity.xyz.com.BlobCity $ sendUserPass.onClick

where blobcity is my class that calls the maps class which contains the mapview. 其中,blobcity是我的类,它调用包含mapview的maps类。

This looks like a classloading or similar issue. 这看起来像类加载或类似的问题。 It seems to be saying that one compiled Java class ("BlobCity.xyz.com.BlobCity.sendUserPass") contains a static dependency on another class ("BlobCity.xyz.com.maps"), but the class loader (or something) couldn't find the class file for the latter class. 似乎是说一个编译的Java类(“ BlobCity.xyz.com.BlobCity.sendUserPass”)包含对另一类(“ BlobCity.xyz.com.maps”)的静态依赖关系,但类加载器(或其他类)找不到后一个类的类文件。

(By the way, your choice of class and package names is pretty awful. You should try to stick to the standard naming conventions if you want other people to be able to understand your code. (顺便说一句,您对类和程序包名称的选择非常糟糕。如果您希望其他人能够理解您的代码,则应该尝试遵循标准的命名约定。

  • All class names ... including nested class names should be in "CamelCase". 所有类名(包括嵌套类名)都应在“ CamelCase”中。
  • Package names should be all lowercase. 程序包名称应全部小写。
  • Hierarchical package names should in reverse domain name order; 分层包名称应按相反的域名顺序排列; eg "com.xyz.blobcity". 例如“ com.xyz.blobcity”。
  • You shouldn't use a random domain name without some kind of permission / authorization ... and there's no way that I'll believe that you work for "xyz.com"!) 您不应该在没有某种许可/授权的情况下使用随机域名...而且我无法相信您为“ xyz.com”工作!)

Try using : 尝试使用:

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

in your AndroidManifest.xml, I have the same problem before and adding <uses-library android:name="com.google.android.maps" /> solve the problem 在您的AndroidManifest.xml中,我之前遇到了相同的问题,并添加了<uses-library android:name="com.google.android.maps" />解决了该问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM