我如何onActivityResult要在Adobe AIR本机扩展运行? [英] How do I get onActivityResult to run in an Adobe Air native extension?

查看:180
本文介绍了我如何onActivityResult要在Adobe AIR本机扩展运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写的扩展,将允许Flex应用程序访问Android的原生影像选择器。我能够启动图像选择器的活动没有问题,但经过它返回给调用者,这是一个FREFunction对象,onActivityResult不叫。正因为如此,我无法找出图像的用户选择。

I am writing an extension that will allow a Flex application to access Android's native image picker. I am able to launch the image picker activity without issue, but after it returns to the caller, which is an FREFunction object, onActivityResult is not called. Because of this, I am unable to figure out what image the user has chosen.

当我使用FREFunction完全相同的内容,在原生的Andr​​oid应用程序,该应用程序正常工作,我能够检索onActivityResult选择的图像的URI。我怎样才能得到onActivityResult火,或至少通过检索图片选择器活动返回的信息?

When I use the exact same contents of the FREFunction in a native Android app, The app works fine, and I am able to retrieve the URI of the chosen image in onActivityResult. How can I get onActivityResult to fire, or at least retrieve the information returned by the image picker activity?

推荐答案

解决的办法是,开始从FREFunction一个活动,然后使用该活动的onActivityResult函数来执行,要求返回活动的数据所需的操作。

The solution is to start an activity from the FREFunction, and then use that activity's onActivityResult function to perform the desired actions that would require the returning activity's data.

从那里,你可以使用的StatusEvent到回信息发送到您的Flex应用程序。确保有监听的StatusEvent,和适当的函数来处理基于事件的标签上的数据。

From there, you can use StatusEvent to send information back to your Flex application. Make sure to have listeners for StatusEvent, and proper functions to handle the data based on the event's label.

注:添加额外为的是要运行您的onActivityResult可能导致活动永远不会被调用的活动。相反,在你的FREFunction创建公共静态字段的活动来调用。

Note: Adding extras to the activity that is to run your onActivityResult may cause the activity to never be called. Instead, create public static fields in your FREFunction for the activity to call.

此外,确保正在活动中使用的上下文是使用原生扩展处理程序FREContext。

In addition, ensure that the context being used in the activity is the FREContext used by the native extension handler.

这篇关于我如何onActivityResult要在Adobe AIR本机扩展运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆