Open assets file, return inputStream - Android App

Android examples for App:Assets File

Description

Open assets file, return inputStream

Demo Code


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

public class Main {
    /**/*  www. j  ava2 s.c  o  m*/
     * Open assets file, return inputStream
     * @param context context
     * @param fullPath such as "dir/file"
     * @return inputStream
     * @throws IOException
     */
    public static InputStream open(Context context, String fullPath)
            throws IOException {
        AssetManager assetManager = context.getAssets();
        return assetManager.open(fullPath);
    }
}

Related Tutorials