Android开与软件包名安装位置 [英] Android get install location with packagename

查看:192
本文介绍了Android开与软件包名安装位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我用下面的code从本教程列出所有安装的应用程序在一个应用程序我工作。

Hi i used the following code from this tutorial to list all of the installed applications in an app i'm working on.

的http:// IM pressive-artworx.de / 2011 /-所有安装列表的应用程序,在风格/

我改变了的onClick我自己的对话,我现在需要做的是能够获取应用程序的位置。也就是说,如果它在/系统/应用或/数据/应用程序我希望能够将整个路径干杯pressed应用程序,但无法弄清楚如何做到这一点。我可以做在onclick app.getPackageName()的软件包名,但我怎么能得到与此有关的APK路径?谢谢你的任何建议或帮助是多少AP preciated!

I changed the onClick to my own dialog and what i now need to do is be able to get the location of the app. That is if it's in /system/app or /data/app i'd like to be able to toast the entire path to the pressed app but can't figure out how to do this. I can get the packagename by doing app.getPackageName() in the onClick but how can i get the apks path with this? Thank you for any suggestions or help it is much appreciated!

推荐答案

多一点谷歌上搜索后,我得到了什么,我一直在寻找

After a bit more googling i got what i was looking for

PackageManager m = getPackageManager();
String s = getPackageName();
PackageInfo p = m.getPackageInfo(s, 0);
s = p.applicationInfo.sourceDir;

工作非常出色在这里找到

worked very well found it here

获取应用程序目录

有关它与我的帮助的谷歌搜索以寻找什么

thanks for the help it helped with my googling as to what to look for

这篇关于Android开与软件包名安装位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆