4 Replies Latest reply on Nov 28, 2017 10:21 AM by Peter Arcuri

    EMDKManager.getEMDKManager return NULL

    Jean-Yves BLANCHETTE

      Hello,
      I am developing an application to programmatically modify a DataWedge profile. But, I can not instantiate my profile manager it is still "null"
      Here is my code:

       

      Thank You for helping

       

      Jean-Yves Blanchette

       

      //********************************************************

      1 - Call

      //********************************************************

      public void jDWMod()

      {

      Intent myIntent = new Intent(getApplicationContext(), clDWMod_TEST.class);

      myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);

      getContexteApplication().startActivity(myIntent);

      }

       

      //********************************************************

      2 - Class

      //********************************************************

      public static class clDWMod_TEST extends Activity implements EMDKListener {

      private EMDKManager emdkManager = null;

      private ProfileManager profileManager = null;

      @Override

      protected void onCreate(Bundle savedInstanceState) {

      super.onCreate(savedInstanceState);

      EMDKResults results = EMDKManager.getEMDKManager(getApplicationContext(), this);

      }

       

      @Override

      public void onClosed() {}

       

      @Override

      public void onOpened(EMDKManager emdkManager) {

      DWMod(emdkManager);

      }

       

      void DWMod(EMDKManager emdkManager)  {

      String profileName = "AI_2";

      String inputFile;

      String ligne;

      StringBuffer stbuf = new StringBuffer();

       

      this.emdkManager = emdkManager;

       

      //********************************************************

      // Problem

      //********************************************************

       

                     AlertDialog AlertDialog0= new AlertDialog.Builder(clDWMod_TEST.this).create();

                     AlertDialog0.setTitle("EMDKManager");

                     AlertDialog0.setMessage(emdkManager.toString()); // Return com.symbol.emdk.EMDKManager@xxxxxxxx

                     AlertDialog0.show();

       

           profileManager = (ProfileManager) this.emdkManager.getInstance(EMDKManager.FEATURE_TYPE.PROFILE);

       

                     if (profileManager != null) {

                          AlertDialog alertDialog1 = new AlertDialog.Builder(clDWMod_TEST.this).create();

                          alertDialog1.setTitle("getInstance");

                          alertDialog1.setMessage(profileManager.toString());

                          alertDialog1.show();

                     }

                     else {

                          AlertDialog alertDialog1 = new AlertDialog.Builder(clDWMod_TEST.this).create();

                          alertDialog1.setTitle("getInstance");

                          alertDialog1.setMessage("NULL"); // Always Return null

                          alertDialog1.show();

                     }

       

      //********************************************************

      // Problem

      //********************************************************

      }

      }