zoukankan      html  css  js  c++  java
  • android 获取Asset中Properties文件配置的键值对

    1 获取 AssetManager

       AssetManager assetManager =  context.getApplicationContext().getAssets();

    2 获取流

        String confFile = "abc.properties";

        Properties conf = new Properties();

        InputStream stream = assetManager.open(confFile);

        conf.load(new InputStreamReader(stream, "utf-8"));

    3 属性值键值对获取

       String key1Value  =  conf.getProperty("key1");

      

    音频文件 一般放在 res/raw下

    1 获取音频管理者  

        AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);

    2 MediaPlayer

        MediaPlayer player = MediaPlayer.create(context,R.raw.sound1);

        player.setLooping(false);//不循环播放

        player.start();//开始播放

        player.release();//在合适的地方调用 释放资源

  • 相关阅读:
    Nginx开启Gzip压缩
    VMware克隆虚拟机,克隆机网卡启动不了解决方案
    Linux 几个简单的操作命令
    1. Java环境搭建及demo
    美柚记录
    action找不到
    < >
    document 写法
    develop process
    git stash
  • 原文地址:https://www.cnblogs.com/exayong/p/6500396.html
Copyright © 2011-2022 走看看