Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: LGPL 

import android.content.res.AssetManager;
import java.io.InputStream;
import java.util.Hashtable;

public class Main {
    private static AssetManager sAssetManager;
    private static Hashtable mFileTable = new Hashtable();

    public static boolean isAssetExists(String path) {
        boolean ret = false;
        if (mFileTable.containsKey(path))
            return (boolean) mFileTable.get(path);
        if (sAssetManager != null) {
            InputStream input = null;
            try {
                input = sAssetManager.open(path);
                ret = true;
                mFileTable.put(path, true);
                input.close();
            } catch (Exception e) {
                mFileTable.put(path, false);
            }
        }
        return ret;
    }
}