In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to obtain the application information installed in the android phone, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let's take a look at it.
Just take it and use it:
/ * whether the application * @ param context * @ param apk_package package name * @ return * / public static boolean isInstallApp (Context context, String apk_package) {PackageInfo packageInfo has been installed Try {packageInfo = context.getPackageManager () .getPackageInfo (apk_package, 0);} catch (NameNotFoundException e) {packageInfo = null; e.printStackTrace () } if (packageInfo! = null) {return true;} return false } / * traverses the specified files in the folder under a path * @ param Path search directory * @ param Extension extension (the suffix of the file type determined) * @ param IsIterative whether to enter the subfolder * @ return * / public static final List GetFiles (String Path, String Extension) Boolean IsIterative) {List apklist = new ArrayList () / / result List try {File [] files = new File (Path). ListFiles (); for (int I = 0; I < files.length; iTunes +) {File f = files [I] If (f.isFile ()) {if (f.getPath () .substring (f.getPath (). Length ()-Extension.length ()) .equals (Extension)) / / determine the extension apklist.add (f.getPath ()) If (! IsIterative) break / / if you do not enter the subset directory, jump out of} else if (f.isDirectory () & & f.getPath (). IndexOf ("/.") = =-1) / / ignore point files (hidden files / folders) GetFiles (f.getPath (), Extension, IsIterative) / / here we begin to recurse}} catch (Exception e) {/ / TODO: handle exception e.printStackTrace ();} return apklist } / * install apk * @ param apk_url * / public static void installApkFromLocalPath (Context context,String apk_url) {try {Intent intent = new Intent (Intent.ACTION_VIEW) according to the local path Intent.setDataAndType (Uri.fromFile (new File (apk_url)), "application/vnd.android.package-archive"); context.startActivity (intent);} catch (Exception e) {/ / TODO: handle exception e.printStackTrace () }} / * Uninstall the application * @ param context * @ param apk_pkg package name * / public static void unInstallApkFromPackage (Context context,String apk_pkg) {try {Intent intent = new Intent (Intent.ACTION_DELETE) Intent.setData (Uri.parse ("package:" + apk_pkg)); context.startActivity (intent);} catch (Exception e) {/ / TODO: handle exception e.printStackTrace () }} / * Open another application according to the package name * @ param context * @ param apk_pkg package name * / public static void openApkFromPackage (Context context,String apk_pkg) {try {Intent intent = new Intent (Intent.ACTION_VIEW) Intent.setComponent (new ComponentName (context, apk_pkg)); context.startActivity (intent);} catch (Exception e) {/ / TODO: handle exception e.printStackTrace () }} Thank you for reading this article carefully. I hope the article "how to get the Information of applications installed in android phones" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.