Java tutorial
//package com.java2s; /******************************************************************************* * Copyright (c) 2013 Zheng Sun. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v3.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl.html * * Contributors: * Zheng Sun - initial API and implementation ******************************************************************************/ import android.content.Context; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; public class Main { public static boolean isPackageAvailable(final Context context, final String packageName) { final PackageManager packageManager = context.getPackageManager(); try { packageManager.getPackageInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES); return true; } catch (final NameNotFoundException exception) { return false; } } }