标签:imp index pac manage 其他 table ext class 通过
Pyjnius 是一个用于访问 Java 类的 Python 库。常用于 Kivy 框架的安卓端访问 Android 类以调用系统级别的api, 实现原生toast, notification等功能
Android通过包名获取其他应用程序的名称
public static String getApplicationNameByPackageName(Context context, String packageName) {
PackageManager pm = context.getPackageManager();
String Name ;
try {
Name=pm.getApplicationLabel(pm.getApplicationInfo(packageName,PackageManager.GET_META_DATA)).toString();
} catch (PackageManager.NameNotFoundException e) {
Name = "" ;
}
return Name
;}
Pyjnius通过包名获取其他应用程序的名称
from jnius import autoclass
def getApplicationNameByPackageName(packageName):
PythonActivity = autoclass("org.kivy.android.PythonActivity")
activity = PythonActivity.mActivity
context = activity.getApplication().getApplicationContext()
pm = context.getPackageManager()
try:
Name = pm.getApplicationLabel(pm.getApplicationInfo(packageName, pm.GET_META_DATA))
except Exception as e:
Name = ""
return Name
标签:imp index pac manage 其他 table ext class 通过
原文地址:https://www.cnblogs.com/cooolr/p/12838146.html