Skip to main content
Inspiring
November 25, 2013
Question

AIR for Android - Native activity is destroyed when app is resumed by clicking on the app icon

  • November 25, 2013
  • 0 replies
  • 874 views

Hello,

I have created a native extension which launches a native android activity with a simple view in it by firing an Intent.

The issue is that when we minimize the app and resume it by either choosing the app icon from apps menu, Android automatically calls the onDestroy of the native android activity and kills it.

I have no idea from where else can the onDestroy function be called? I need to figure out a way to stop the native activity from being destroyed on app resume.

The code to launch the native activity is something like this:

Intent intent = new Intent("com.app.myAcivity");

intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

context.getActivity().startActivity(intent);

The entry for the activity in the manifest goes like this:

<activity android:name="com.app.myAcivity"/>

I have read a lot of blogs and SO questions but could not get around this issue. Please help.

I don't have this problem with native Android app.

Thanks.

This topic has been closed for replies.