Advertisement
Kimossab

Calc Test

Mar 28th, 2015
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.28 KB | None | 0 0
  1.     public void GoLL(View V)
  2.     {
  3.         try
  4.         {
  5.             ArrayList<HashMap<String, Object>> items = new ArrayList<HashMap<String, Object>>();
  6.             final PackageManager pm = getPackageManager();
  7.             List<PackageInfo> packs = pm.getInstalledPackages(0);
  8.             for(PackageInfo pi : packs)
  9.             {
  10.                 if(pi.packageName.toLowerCase().contains("calculhgchfhf") && pi.packageName.toLowerCase().contains("com."))
  11.                 {
  12.                     HashMap<String, Object> map = new HashMap<String, Object>();
  13.                     map.put("appName", pi.applicationInfo.loadLabel(pm));
  14.                     map.put("packageName", pi.packageName);
  15.                     items.add(map);
  16.                 }
  17.             }
  18.             if(items.size() >= 1)
  19.             {
  20.                 String packageName = (String)items.get(0).get("packageName");
  21.                 Intent i = pm.getLaunchIntentForPackage(packageName);
  22.                 if(i != null) startActivity(i);
  23.             } else
  24.             {
  25.                 this.startActivity(new Intent(this, LL.class));
  26.             }
  27.         }
  28.         catch(Exception e)
  29.         {
  30.             Log.e("Erro",e.getMessage());
  31.             Toast.makeText(getApplicationContext(),).show();
  32.         }
  33.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement