小编bak*_*a83的帖子

将自己的属性文件放在用Android Studio创建的android项目中的哪里?

我刚开始使用Android Studio.我不知道在哪里放置我自己的属性文件,因为项目结构中没有assets文件夹.

已发布的代码段在eclipse中工作正常,但在Android Studio中却没有.

码:

    Properties prop = new Properties();

    try {
        //load a properties file
        prop.load(new FileInputStream("app.properties"));

        //get the property value and print it out
        System.out.println(prop.getProperty("server_address"));

    } catch (IOException ex) {
        ex.printStackTrace();
    }
Run Code Online (Sandbox Code Playgroud)

问题1: 在Android Studio(v0.5.8)中放置我自己的属性文件的位置?

问题2: 我如何访问它们?

android android-studio

13
推荐指数
2
解决办法
3万
查看次数

标签 统计

android ×1

android-studio ×1