Android根据包名取得指定程序包的信息(名称、图标……)

Android 通过packagename(包名)获取App的名称和图标 根据包名获取App的相关信息如下: private PackageManager packageManager; packageManager= mContext.getPackageManager(); ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packagename, PackageManager.GET_META_DATA); if(applicationI 阅读详情
Android根据包名取得指定程序包的信息(名称、图标……)



本文讨论如何根据包名取得程序包相关信息,本例演示取得Android系统程序的名称和图标(注意:并不是每一个程序包都有程序名称和图标)。

效果图如下:

主程序源码如下:

package com.plter.getsystemicon;
 
import android.app.Activity;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
 
public class P0001_GetSystemIconActivity extends Activity {
 
    private ImageView appIconIv;
    private TextView appNameTv;
    private LinearLayout.LayoutParams llp=new LinearLayout.LayoutParams(-2, -2);
    private LinearLayout mainLayout;
 
    private PackageManager pm;
    private ApplicationInfo appInfo;
    private Drawable appIcon;
 
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
 
        mainLayout=(LinearLayout) findViewById(R.id.mainLayout);
 
        appNameTv=new TextView(this);
        mainLayout.addView(appNameTv, llp);
 
        appIconIv=new ImageView(this);
        mainLayout.addView(appIconIv, llp);
 
        pm=getPackageManager();
        try {
            appInfo=pm.getApplicationInfo("system", PackageManager.GET_META_DATA);
 
            appNameTv.setText(pm.getApplicationLabel(appInfo));
 
            appIcon=pm.getApplicationIcon(appInfo);
            appIconIv.setImageDrawable(appIcon);
 
        } catch (NameNotFoundException e) {
            e.printStackTrace();
        }
    }
}

main.xml布局文件源码如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/mainLayout"
    >
</LinearLayout>

AndroidManifest.xml文件源码如下:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.plter.getsystemicon"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="8" />
 
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".P0001_GetSystemIconActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
 
    </application>
</manifest>



篡改Apk名称、图标 往期推荐 AndroidKiller介绍与使用 什么是虚拟机?虚拟机有那几种 APK安装流程及详细步骤 APK打包流程 APK文件结构 1.1 篡改APK名称 以土豆视频篡改为优酷视频为例: 1.第一步,打开AndroidKiller工具,把“土豆视频”APP拖入到AndroidKiller工具里,开始自动反编译,反编译完成后会弹出一个窗口,如图2.1所示。点击“否”后,可以看到土豆图标旁边有三项内容:名称、包名以及入口。“土豆视频”是程序的名称,要篡改的APK名称就是修改这个字符串,第二项包名即应用程序 阅读详情

相关推荐

android 获取手机中打应用图标,包名,类名

android 获去手机中应用图标,包名类名(主菜单显示的应用)

android adb 非root情况下获取通过应用包名获取UID

adb shell dumpsys package 包名 | grep userId= 方法2:ps -ef|grep 包名 方法2有个缺陷就是应用包名必须运行起来,方法1只要安装了就可以,推荐方法1

babytiger的专栏 2219

上机笔试题目:取出指定条件二维数组的子数组

取出指定条件二维数组的子数组: 1)传入参数为: 参数一:String[][]sArray2字符串二维数组 参数二:Stringkey字符串 参数三:StringkeyFormat含匹配符的字符串,如下:%0-%1,其中%x含义如为:一维数据列序号为x的值。 keyFormat 可以为 %0-%1-%2,%0-%3-%8-%x...... 例子如下...

91奔跑的蜗牛 643

adb Android id,通过adb获取task id

/*** 通过包名获取task id,不存在为-1** @param packageName* @return*/public int getTaskId(String packageName) {String result = execRootCmd("dumpsys activity | grep " + packageName);int start = result.indexOf("Tas...

weixin_32968007的博客 1687

VMware Workstation Pro 16 安装 Ubuntu 20.04

VMware Workstation Pro 16 安装 ubuntu 20.04目录环境VMware Workstation下载Ubuntu 20.04下载安装过程 目录 环境 Windows 10 Workstation 16 Pro for Windows Ubuntu 20.04 LTS 64位 desktop版本 VMware Workstation下载 链接: https://www.vmware.com/products/workstation-pro/workstation-pro-eval

qq_45642410的博客 1万+

bcftools实战指南:从VCF文件处理到变异分析全流程解析

在基因组数据分析中,VCF(Variant Call Format)文件是存储基因序列变异信息的标准格式,广泛应用于群体遗传学和生物信息学研究。其核心原理是通过结构化文本记录SNP、INDEL等变异位点的基因型、质量值和注释信息。掌握高效处理VCF文件的技术,对于提升变异检测、数据清洗和下游分析的工作流效率具有重要价值。在生物信息学工具生态中,bcftools作为处理VCF/BCF文件的瑞士军刀,通过模块化设计实现了数据查询、过滤、统计和格式转换等核心功能。其流式处理架构支持管道化操作,能有效应对海量基因组

weixin_29081703的博客 332

android 获取进程、服务、任务列表

 获取进程列表,需使用ActivityManager中的方法获取进程名;再根据进程名,获取应用程序的ApplicationInfo对象;用ApplicationInfo中的方法为进程加载图标和程序名称。获取服务、任务列表方法同上。   1 实例化ActivityManager private ActivityManager

dongsheng186的专栏 995

目前最新NIST随机数测试软件下载、安装、及使用教程

最近由于科研需要,在搞一些随机数的测试的事情,众所周知 随机数测试我们可以使用NIST的软件进行多大15项的随机测试,我也在网上查找了很多大牛的博客,但是都是年代久远,很多的链接现在都是物是人非,都是不能直接使用了,今天顺便抽点时间更新一下这个NIST软件的下载及使用。我们首先讲一下该软件的下载:1.我们直接取NIST的官网(https://csrc.nist.gov/)下载即可 ;链接如下:下载...

Miracle.Zhao的博客 3万+

Android通过包名获取应用信息

包名

Gufra_Yin的博客 4491

STM32硬件SPI驱动W5500以太网模块全流程(附避坑指南)

本文详细介绍了STM32硬件SPI驱动W5500以太网模块的全流程,包括硬件架构设计、SPI接口选型、官方驱动移植、网络协议栈配置与优化等关键步骤。通过实战案例和性能对比数据,帮助开发者快速实现稳定高效的网络连接,特别提供了常见问题排查指南和性能调优技巧。

weixin_29194693的博客 276

Livox-avia+FAST-LIO麻瓜使用教程

激光雷达 SLAM Fastlio 安装

aaaaaaaaaww12的博客 3687

获取android 应用程序包名、图标、应用名称

有时候我们在开发程序时需要用到获取手机中已安装程序的包名、图标、应用名称,在这里写一篇简单的博客 还是跟往常一样,先上图,最后会给出程序的Demo 从上图可以看出,每个 Item 都包含了相应信息,所以在此为了封装信息,就写了一个 信息封装类 package com.cn.sz.fisi.appinfo.mode; import android.graphics.drawable.

qijian0503的专栏 1万+

手把手教你用FPGA+AD9822搭建300DPI的CIS高速图像采集系统(附时序调试心得)

本文详细介绍了如何利用FPGA作为核心控制器,结合AD9822三通道采样保持放大器/ADC,构建一套完整的300DPI CIS高速图像采集系统。内容涵盖从CIS传感器驱动时序、AD9822寄存器配置与协同调试,到采用千兆以太网替代USB实现稳定高速数据传输的完整实战指南,并分享了关键的时序调试心得与系统集成经验。

weixin_29306261的博客 144

代码获取应用程序的名称,包名,版本号和图标

class PInfo { private String appname = \"\"; private String pname = \"\"; private String versionName = \"\"; private int versionCode = 0; priv...

青年IT男 525

2026年3月GESP真题及题解(C++七级):物流网络

2026年3月GESP真题及题解(C++七级):物流网络

王老师青少年编程 1138

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

android 获取应用程序包名,图标,入口Activity类

最近老是用到关于程序包名,图标问题,现总结如下: [java] view plaincopy PackageInfo info;             try {                 info = this.getPackageManager().getPackageInfo(this.getPackageName(), 0);

我的地盘 3142

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

60遍历获取手机安装的应用程序的图标、应用名称等信息的方法

通过使用PackageManager的getInstalledPackages得到已经安装程序,通过PackageInfo得到应用程序的包名和图标和应用程序名字: package com.ustc.mobilemanager.engine; import java.util.ArrayList; import java.util.List; import android.content.Co

chenfuduo_loveit的专栏 1051

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

android 反编译拿图标,安卓逆向学习——篡改Apk名称和图标

我们以土豆视频篡改为优酷视频为例,来讲解怎么篡改apk的名称和图标。篡改APK名称第一步,打开AndroidKiller工具,把“土豆视频”APP拖入到AndroidKiller工具里,开始自动反编译,反编译完成后会弹出一个窗口,如图所示:点击“否”后,可以看到土豆图标旁边有三项内容:名称、包名以及入口。“土豆视频”是程序的名称,要篡改的APK名称就是修改这个字符串,第二项包名即应用程序包名,第三...

weixin_33736279的博客 1174

Android获取手机应用程序包的信息

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34161032的博客 178

获取未安装apk的软件包信息

方法: /** 获取未安装的APK信息 * @param context * @param archiveFilePath APK文件的路径。如:/sdcard /download/XX.apk */ public void getUninatllApkInfo(Context context, String archiveFilePath){ PackageMana

Vincent_czz的专栏 4343

Android 如何有效快速修改包名(层级展开)

在我们进行Android项目开发时,在某些情况下,我们需要修改已有项目工程中的包名。(然而测试的时候,安卓系统等是根据包名,安装项目。以及判断包名是否存在。),包名就像我们每个人的身份证,简单地说。 Eclipse提供了androidTools->Rename Application Package的方法修改包名,然而这种方法常常不靠谱,会有异常情况发生。 经过实践表明,以下方法最简

冷冷清清里风风火火是我 1525

Android中程序包的相关操作

1 //获取系统中已经安装的应用程序 2 List<PackageInfo> packageinfos=this.getPackageManager().getInstalledPackages(PackageManager.GET_UNINSTALLED_PACKAGES); 3 String packageName=packageInfos.get(posi...

dieshengla2331的博客 122

(获取应用的包名/应用名等信息)打开、安装和卸载应用

实现功能: 从本应用打开另外一个应用。 通过应用名称appName打开另外一个应用: 1、首先获取系统应用/所有应用的包名/应用名/Activity名称/Icon等信息: ①获取系统应用: (从应用名称获取系统应用的包名和程序的Activity名) // 获得所有系统的 public void querySysAppInfo() { PackageManage

huaxa程序猿 2910
上一篇: 自定义listview的显示(重写Adapter)
下一篇: Handler 的使用
Jacob-wj
博客等级 码龄16年 1198粉丝 506原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值