load Properties from Asset - Android java.util

Android examples for java.util:Properties

Description

load Properties from Asset

Demo Code


//package com.java2s;

import java.io.InputStream;

import java.util.Properties;
import android.content.res.AssetManager;
import android.util.Log;

public class Main {
    private static Properties properties = null;

    public static void loadProperties(AssetManager assetManager) {
        // Read from the /assets directory
        try {/*from  ww  w  .j  a  v  a 2  s . co  m*/
            InputStream inputStream = assetManager.open("env.conf");
            properties = new Properties();
            properties.load(inputStream);
            inputStream.close();
        } catch (Exception e) {
            Log.i("PronosChallenge", "Failed to open env.conf file");
            e.printStackTrace();
        }

    }
}

Related Tutorials