NativeScript android 本机库实现

NativeScript android native library implementation

我正在尝试在我的一个项目中实施 GalleryPicker,如下所示:

let activity = app.android.foregroundActivity || app.android.startActivity;
let i = android.content.Intent(activity, com.picker.gallery.view.PickerActivity.class)
i.putExtra("IMAGES_LIMIT", 4)
i.putExtra("VIDEOS_LIMIT", 1)
i.putExtra("REQUEST_RESULT_CODE", 101)
app.android.foregroundActivity.startActivityForResult(i, 101);

但是我收到这个错误:

ERROR Error: Trying to link invalid 'this' to a Java object
JS: ERROR CONTEXT {
JS:   "view": {
JS:     "def": {
JS:       "nodeFlags": 33603585,
JS:       "rootNodeFlags": 33554433,
JS:       "nodeMatchedQueries": 0,
JS:       "flags": 0,
JS:       "nodes": [
JS:         {
JS:           "nodeIndex": 0,
JS:           "parent": null,
JS:           "renderParent": null,
JS:           "bindingIndex": 0,
JS:           "outputIndex": 0,
JS:           "checkIndex": 0,

我哪里做错了?提前致谢

看起来您没有创建 new Intent 实例,这可能是您的问题。

所以...

new android.content.Intent(...