我试图在android中检索安装的应用程序的列表。我写了下面的代码:无法对非静态方法进行静态引用getPackageManager()
final Intent myIntent = new Intent(Intent.ACTION_MAIN, null);
myIntent.addCategory(Intent.CATEGORY_LAUNCHER);
final List AppsList = Context.getPackageManager().queryIntentActivities(myIntent, 0);
我收到此错误:
Cannot make a static reference to the non-static method getPackageManager() from the type Context
知道,无论Context
和PackageManager
是抽象类,不能纠正错误。请帮助。