Java tutorial
//package com.java2s; /***************************************************************************** * LibVlcUtil.java ***************************************************************************** * Copyright 2011-2013 VLC authors and VideoLAN * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ import android.annotation.TargetApi; import android.content.pm.ApplicationInfo; import android.os.Build; import android.util.Log; import java.io.File; public class Main { public final static String TAG = "VLC/LibVLC/Util"; @TargetApi(Build.VERSION_CODES.GINGERBREAD) private static File searchLibrary(ApplicationInfo applicationInfo) { // Search for library path String[] libraryPaths; if ((applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) { final String property = System.getProperty("java.library.path"); libraryPaths = property.split(":"); } else { libraryPaths = new String[1]; libraryPaths[0] = applicationInfo.nativeLibraryDir; } if (libraryPaths[0] == null) { Log.e(TAG, "can't find library path"); return null; } // Search for libvlcjni.so File lib; for (String libraryPath : libraryPaths) { lib = new File(libraryPath, "libvlcjni.so"); if (lib.exists() && lib.canRead()) return lib; } Log.e(TAG, "WARNING: Can't find shared library"); return null; } }