public static boolean isInstalled(PackageManager packageManager,String packageName){
  List<PackageInfo> packs=packageManager.getInstalledPackages(0);
  for (int i=0; i < packs.size(); i++) {
    if (TextUtils.equals(packs.get(i).packageName,packageName))     return true;
  }
  return false;
}

public static boolean isInstalled ( PackageManager packageManager , String packageName ) { List < PackageInfo > packs = packageManager . getInstalledPackages ( 0 ) ; for ( int i = 0 ; i < packs . size ( ) ; i ++ ) { if ( TextUtils . equals ( packs . get ( i ) . packageName , packageName ) ) return true ; } return false ; }
checks if the app has been installed on the system .
