Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.io.IOException;
import java.io.InputStream;
import android.content.Context;
import android.content.res.AssetManager;

public class Main {
    public static boolean hasAssetFile(Context c, String filePath) {
        boolean hasFile = false;
        InputStream inputStream = null;
        try {
            AssetManager am = c.getAssets();
            inputStream = am.open(filePath);
            hasFile = true;
        } catch (Exception e) {
            e.printStackTrace();
            hasFile = false;
        } finally {
            if (inputStream != null) {
                try {
                    inputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        return hasFile;
    }
}