get InputStream From Assets - Android App

Android examples for App:Assets

Description

get InputStream From Assets

Demo Code


//package com.java2s;

import android.content.Context;

import java.io.FileNotFoundException;
import java.io.InputStream;

public class Main {

    public static InputStream getFromAssets(Context context, String fileName)
            throws FileNotFoundException {
        InputStream inputStream = null;
        try {/*from   w  ww.  ja  v  a2  s  . com*/
            inputStream = context.getResources().getAssets().open(fileName);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return inputStream;
    }
}

Related Tutorials