我们必须编写一个知道如何打开.xyz文件的Android应用程序。如何找到传递给Android上的Delphi应用程序的文件?
但是,当我们将.xyz文件分配给我们的应用程序时,之后我们点击Android文件资源管理器中的.xyz文件,应用程序已正确启动,但程序没有看到文件名作为参数。
代码
ShowMessage(ParamStr(0)); //for debug...
ShowMessage(ParamStr(1));
而是在消息框中显示应用程序的完整路径的完整路径,并在此之后,轻触(点击)文件名就显示了两个空字符串。
我们如何获得点击(点击)文件的完整路径?
UPDATE:
(的一部分)的清单如下:
<activity android:name="com.embarcadero.firemonkey.FMXNativeActivity"
android:label="MMBook"
android:configChanges="orientation|keyboardHidden">
<!-- Tell NativeActivity the name of our .so -->
<meta-data android:name="android.app.lib_name"
android:value="MMBook" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" android:host="*" android:pathPattern=".*\\.mma" android:mimeType="*/*" />
</intent-filter>
</activity>
不要忘记检查,如果'getIntent()'返回'nil'指针,表示该应用程序是正常启动。此外,这个答案不是用Delphi编写的(这个片段不是用Delphi语法编写的,也没有显示如何在Delphi中调用'getIntent()')。 – 2014-10-27 19:22:05