read Assets File and return InputStream - Android App

Android examples for App:Assets File

Description

read Assets File and return InputStream

Demo Code


//package com.java2s;
import android.content.Context;
import java.io.IOException;
import java.io.InputStream;

public class Main {
    public static InputStream readAssetsFile(Context context,
            String filePath) {//  w  w w.  ja v  a 2s .  com
        InputStream inputStream = null;
        try {
            inputStream = context.getAssets().open(filePath);
        } catch (IOException e) {
            e.printStackTrace();
        }

        return inputStream;
    }
}

Related Tutorials