title: How to use Java's inner anonymous classes in Nativescript-angular?
body: <p>I would like to implement below Java's implementation in Nativescript-angular where it uses interface implementation using anonymous class concept.</p>
  <p>I have followed the below link.
  <a href="https://docs.nativescript.org/core-concepts/android-runtime/binding-generator/extend-class-interface" rel="nofollow noreferrer">https://docs.nativescript.org/core-concepts/android-runtime/binding-generator/extend-class-interface</a></p>
  <p>Java code:</p>
  <pre><code>import com.microsoft.identity.client.IPublicClientApplication;
  
  public class SingleAccountModeFragment extends Fragment {
  
  private ISingleAccountPublicClientApplication mSingleAccountApp;
  
  public void initialize()
  {
      PublicClientApplication.createSingleAccountPublicClientApplication(getContext(),
                  R.raw.auth_config_single_account,
                  new IPublicClientApplication.ISingleAccountApplicationCreatedListener() {
                      @Override
                      public void onCreated(ISingleAccountPublicClientApplication application) {
                          mSingleAccountApp = application;
                          loadAccount();
                      }
  
                      @Override
                      public void onError(MsalException exception) {
                          displayError(exception);
                      }
                  });
  }
  private void loadAccount() { 
      //some code  
  }
  }
  </code></pre>
  <p>Typescript code:</p>
  <pre><code>export class LoginService{
      mSingleAccountApp;
      res = utils.ad.resources.getId(&quot;:raw/auth_config&quot;);
      context = applicationModule.android.context;
  
      constructor() {
          console.log(&quot;Constructor created&quot;);
          console.log(&quot;value of res is: &quot;, this.res);
          const test = global.com.microsoft.identity.client.PublicClientApplication.createSingleAccountPublicClientApplication(this.context,this.res,      
                  new global.com.microsoft.identity.client.IPublicClientApplication.ISingleAccountApplicationCreatedListener( 
                  {
                      constructor() {},
                      onCreated: function(application) {
                          this.mSingleAccountApp = application;
                          this.loadAccount();
                      },
                      onError: function(exception) {
                          //displayError(exception);
                      }
                  }));
      }
  
      loadAccount(): void {
          console.log(&quot;Account is loaded&quot;);
      }
  </code></pre>
  <p>I am not able to use &quot;mSingleAccountApp&quot; outside the interface implementation (Anonymous class) in TypeScript. It gives me error as undefined. If I access the variable &quot;mSingleAccountApp&quot; inside interface implementation then it is defined.</p>
  <p>I am also not able to call loadAccount() function of LoginService service. Seems like &quot;this&quot; pointer is  pointing to the interface implementation (Anonymous class) and not to the LoginService class</p>
  <p>In JAVA code, both the things are possible and I would like to achieve similar in TypeScript.</p>
  <p>Thank you in advance.</p>