gpt4 book ai didi

android - 我可以在android中的文件夹\scr下添加新包吗?

转载 作者:搜寻专家 更新时间:2023-11-01 08:55:09 25 4
gpt4 key购买 nike

我创建了一个包名为 info.dodata.smsforward 的应用程序,eclipse 创建了一个默认文件结构,就像 Old.PNG 一样。
enter image description here

我觉得\scr文件夹下的文件结构不好,所以我加了三个包名BLL、DLL、UI,把不同的类文件放到不同的包名下,就像New.PNG一样。 enter image description here

我的问题是

A: 我可以在文件夹\scr 下添加新包吗?你知道 AndroidManifest.xml 中只有一个 package="info.dodata.smsforward",我不知道一个 android 应用程序中是否只允许一个包名称。

B:我的包名是不是太短了?我需要在包名 BLL、DAL 和 UI 之前添加我的域吗?短包名(如BLL、DLL)会不会和其他APP冲突?

旧模式Public.java

package info.dodata.smsforward;
public class ModePublic {

public final static int DBVersion=2;
public final static String DBName="smsforward.db";
}

旧的 AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="info.dodata.smsforward"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="info.dodata.smsforward.UIMain"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>

新ModePublic.java

package DAL;
public class ModePublic {
public final static int DBVersion=2;
public final static String DBName="smsforward.db";
}

新的 AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="info.dodata.smsforward"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="UI.UIMain"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>

最佳答案

A. 是的,你可以,你喜欢多少包就有多深。

B. 没有这方面的规定。其他人很难理解你用这么短的名字是什么意思。因此,当与更多人一起工作时,起个更好听的名字可能会更好。它们不会与其他应用程序冲突,因为它们仅存在于您的初始包名称目录中。 ( list )

注意:AndroidManifest.xml 包名称用作应用程序的唯一标识符。并创建生成类的初始文件夹。例如 bin/classes/info/dodata/smsforward/ Java 包本质上只是 src 目录中的文件夹。您使用它们来 bundle 您的接口(interface)和类。

关于android - 我可以在android中的文件夹\scr下添加新包吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19569044/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com