How can I get relative path of the folders in my android project?

前端 未结 8 1718
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-08 19:16

How can I get the relative path of the folders in my project using code?

I\'ve created a new folder in my project and I want its relative path so no matter where the

8条回答
  •  南笙
    南笙 (楼主)
    2020-12-08 20:03

    Are you looking for the root folder of the application? Then I would use

     String path = getClass().getClassLoader().getResource(".").getPath();
    

    to actually "find out where I am".

提交回复
热议问题