b4a 获取自身app安装路径

原本java代码应该是这样的

String path = getApplicationContext().getPackageResourcePath();
System.out.println("path===" + path);

在basic4android代码是这样的

Dim r As Reflector
r.Target = r.GetContext
r.Target = r.RunMethod("getPackageManager")
r.Target = r.RunMethod3("getPackageInfo", Application.PackageName, "java.lang.String", 0x00000001, "java.lang.int")
r.Target = r.GetField("applicationInfo")
Dim path As String = r.GetField("sourceDir")
ToastMessageShow(path,False)
Log(path)
点赞