Get the package name and version number for other apps on your Android phone

Source: Internet
Author: User

Reprint Please specify source: http://blog.csdn.net/jason_src/article/details/37757661


There are many ways to get the package name and version number for other apps on your Android phone, which can be obtained directly from the APK package via AAPT or via code on your phone. Obviously, for the product or user to obtain this information, on the phone to obtain more convenient.


Let's look at how to get the package name, version number of the other app on the phone.

Core: Through Packagemanager can get the information we want, such as: program icon, program name, package name, Versionname, Versioncode and so on.

/* * @Author Sun Ruichuan *  * */public arraylist


Once you get the information you need, you can put that information into your custom Listadaptar.

Class Myadapter extends Baseadapter {public class Holder {TextView tv_pakagename; TextView Tv_versioncode; TextView Tv_versionname; TextView Tv_appname;imageview Iv_logo;} @Overridepublic int GetCount () {return allprocess.size ();} @Overridepublic hashmap<string, object> getItem (int position) {return allprocess.get (position);} @Overridepublic long Getitemid (int position) {return position;} @Overridepublic view GetView (int position, view Convertview, ViewGroup parent) {Holder Holder; View v;if (Convertview = = null) {holder = new holder (); v = layoutinflater.from (Getapplicationcontext ()). Inflate (r.layout . List_menu, null); holder.tv_pakagename = (TextView) V.findviewbyid (r.id.tv_pakagename); Holder.tv_versioncode = ( TextView) V.findviewbyid (r.id.tv_versioncode); holder.tv_versionname = (TextView) V.findviewbyid (r.id.tv_ Versionname); Holder.iv_logo = (ImageView) V.findviewbyid (R.id.iv_logo); holder.tv_appname = (TextView) V.findviewbyid (r.id.tv_appname); V.settag (holder);} else {v = convertview;holdER = (Holder) V.gettag ();} Holder.tv_pakagename.setText ("Package Name:" + allprocess.get (position). Get ("PackageName"). toString ()); holder.tv_ Versioncode.settext ("Versioncode:" + allprocess.get (position). Get ("Versioncode"). toString ()); holder.tv_ Versionname.settext ("Versionname:" + allprocess.get (position). Get ("Versionname"). toString ()); holder.iv_ Logo.setimagedrawable ((drawable) allprocess.get (position). Get ("Appimage")); Holder.tv_appname.setText ("app Name:" + Allprocess.get (position). Get ("AppName"). toString ()); return v;}}

This completes the corresponding work.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.