android 添加java文件,将Java文件夹添加到android studio项目

博主遇到了在Android Studio中尝试使用子文件夹来组织Java类的问题,但无法直接引用这些类。通常,IntelliJ IDEA会混合包和目录。解决方法是右键点击java文件夹,新建->包,然后添加所需目录,这样可以更好地组织项目结构。
摘要由CSDN通过智能技术生成

Started working on my first project using Android Studio instead of Eclipse ADT.

I would like to add sub folders to contain java.classes in order to structure my app but are unable to obtain references to them in my activity

structure is (with app name replaced)

src/main/[MyCompany]/[myAppName]/model/user.java

and

src/main/[MyCompany]/[myAppName]/helperClasses/SQLiteHelper.java

however I am unable to reference them either directly in code or by import, and are forced to put them in the appName folder with the activity to reference them.

Is this simply a limitation in Android or is there a way to organize your project with folders better. I used the new->folder-java folder option to create folders

解决方案

IntelliJIdea mixes packages and directories.

So, right click on the java folder, click new - 'Package', then add your directory.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值