android eclipse 中的n层架构?

发布于 2024-12-12 14:48:31 字数 132 浏览 1 评论 0原文

我想将我在 eclipse 中编写的 android 项目中的不同包中的类分组在一起。类似于 MVC 方法。

我想知道如何解决这一问题,我尝试了一下,但从清单中收到错误,如何成功添加多个包?

谢谢,

I want to group classes together in different packages in my android project I am writing in eclipse. Similar the the MVC approach.

I was wondering how I would go about this, I tried it and I am getting errors from the manifest, how do I successfully add more than one package?

Thanks,

Ben

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

╄→承喏 2024-12-19 14:48:34

你能发布你的清单吗?这可能有助于找出问题的根源。

另外,请查看此线程,如这似乎就是你想要的。

基本上,为每个方面创建子包。因此,它们将是

com.yourapp.model
com.yourapp.view
com.yourapp.controller

,您的清单将如下所示

<manifest package="com.yourapp" . . . >
    <application . . .>
        <activity android:name=".model.Activity1" . . . />
        <activity android:name=".view.Activity2" . . . />
        <activity android:name=".controller.Activity3" . . . />
    </application>
</manifest>

,但您可能在每个包中都没有活动,这只是向您展示如何在需要时访问它们。

Could you post your manifest? It might help get to the bottom of the issue.

Also, take a look at this thread, as it seems to be what you want.

Basically, create subpackages for each aspect. So they would be

com.yourapp.model
com.yourapp.view
com.yourapp.controller

and your manifest would look like

<manifest package="com.yourapp" . . . >
    <application . . .>
        <activity android:name=".model.Activity1" . . . />
        <activity android:name=".view.Activity2" . . . />
        <activity android:name=".controller.Activity3" . . . />
    </application>
</manifest>

But you might not have activities in each of these packages, that's just to show you how you could access them if you need to.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文