我想創建一個非常簡單的代碼來從另一個應用程序打開一個應用程序。找不到符號PackageManager
使用的代碼如下,
android.app.Activity import;
android.content.Context import;
android.content.Intent import;
android.content.pm.PackageManager import;
public static void LaunchApplication()
{
GetPackageManager PackageManager = PackageManager();
startActivity(packageManager.getLaunchIntentForPackage("antay.cfsatv30localization"));
}
...但我編譯時得到以下錯誤: 返回錯誤:
src\antay\startandstopapp\wdgen\GWDCPCOL_GlobalProcedures.java:106: error: cannot find symbol
getPackageManager();
^
symbol: method getPackageManager()
location: class GWDCPCOL_GlobalProcedures
======== ===========
src\antay\startandstopapp\wdgen\GWDCPCOL_GlobalProcedures.java:107: error: cannot find symbol
startActivity(packageManager.getLaunchIntentForPackage("antay.cfsatv30localization"));
^
symbol: method startActivity(Intent)
location: class GWDCPCOL_GlobalProcedures
2 errors