开发者

Android - adding class to manifest

I'm a newbie to Android, so pardon me for asking (probably) the obvious.

I've created a class similar to this:

public class myClass  {
    public int id;
    public String name;
}

but when I try running the app in the emulator it gives me the "The application has stopped unexpectedly". I'm guessing that it has something to do with registe开发者_如何转开发ring or adding this class to the manifest, but I'm not quite sure how to do it. I'd very much appreciate your help. Thanks a lot.


Your class is not an activtiy (at least the way you posted it ;-) so no entry in the manifest is needed.

Have a look here http://developer.android.com/guide/topics/fundamentals/activities.html for information about activities and how to add them to the manifest. The best way to understand this when starting with Android is to create a hello world demo (can be done in eclipse when creating a new project)

Have you looked in the LogCat what the crash is about? There should be an error stack trace printed. Here Getting information from logCat window someone explained by screenshots how to use that eclipse view.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜