0 Replies Latest reply: Oct 22, 2013 1:15 AM by HungryCatMari RSS

    A request or bug report FREContext.

    HungryCatMari Community Member

      A request or bug report FREContext.

       

      I hope FREContext.dispose() can take argments like FREObject.call() in further update.

      Because when I create two instances of FREContext in Air,

      some of resource in java is overridden.

      I want to return id from java to air and when its removes I want to use that id.

       

      For example,in java,I keep admob-object as class variable when its created.

       

      When dispose() is called,I need to remove admob-object from activity.

      This is the sample.

      1st created adsdk is overriden by 2nd if I create double-ane instance in Air.

       

      //    Adding view on Activity

      public class ANEAdfuri_adfurisdk implements FREFunction{

          public FREObject call(FREContext arg0, FREObject[] arg1) {

              root = (ViewGroup) _activity.getWindow().getDecorView();

              // many logics

              int id = xxxx;

              view.setId(id);

              root.addView(view);

              return makeFREObject(Integer.toString(id));

          }

      }

       

      //    Removing view on Activity

      public class ANEAdfuriExtensionsContext extends FREContext{

          private admob adsdk;

       

          @Override

          public void dispose(FREObject[] arg1)

          {

              Activity act = super.getActivity();

              String str1 = arg1[0].getAsString();

              int id = Integer.parseInt(str1);

              ViewGroup vg = (ViewGroup)act.getWindow().getDecorView();

              admob tmnp = vg.findViewById(id);

              vg.removeView(tmnp);

          }

      }