title: Still getting Nullpointer when envoking Native Android libs using Codename One NativeInterface
body: <p>I am building a Codename One applications that includes a 3rd party Android Lib. This means the use of NativeInterface. The 3rd Party lib is sreaderautolib_v1.1.jar. Used on Android to comms to a magstrip reader using the sound port.</p>
  
  <ul>
  <li>I've included the jar in my CN1 project under the native\android folder.</li>
  <li>I created a Swipe interface that extends the NativeInterface (package co.za.jaco.swiperapp.components;).</li>
  <li>I right clicked on the Swipe interface and selected Generate Native Access and edited the resulting SwipeImpl under the native\android\co\za\jaco\swiperapp\components\ folder.</li>
  <li>I also have the correct Android permissions specified in the CN1 build hints (android.xpermissions), this is to use the sound port.</li>
  </ul>
  
  <p>I can build it (sending it to CN1 servers) and install it on my phone but keep on getting a Nullpointer after a certain line.
  I think my understanding on how to implement NativeInterfaces on CN1 is lacking and it is code related, but I cannot see the error.</p>
  
  <p>Please help !!</p>
  
  <p>Swipe :</p>
  
  <pre><code>package co.za.jaco.swiperapp.components;
  
  import com.codename1.system.NativeInterface;
  
  public interface Swipe extends NativeInterface {
  
  public boolean Init();
  
  public boolean isInit();
  
  public void Start();
  
  public void Stop();
  
  public void SetMute(boolean mute);
  
  public String GetErrorString();
  
  public boolean Initial(long millis);
  
  public String GetVersion(long millis);
  
  public String GetKSN(long millis);
  
  public String GetRandom(long millis);
  
  public String ReadCard(long millis);
  
  public String GetT1PAN(long millis);
  
  public String GetT1HolderName_Exd(long millis);
  
  public String GetT2PAN(long millis);
  
  public String GetT2Exd(long millis);
  
  public void Cancel();
  
  public String GenerateWorkingKey(String random, String ksn);
  
  public String TriDesDecryption(String dnc_key, String en_data);
  }
  </code></pre>
  
  <p>SwipeImpl :</p>
  
  <pre><code>package co.za.jaco.swiperapp.components;
  
  public class SwipeImpl {
  private com.singular.hijack.autofreq.SReaderApi getSreaderInstance(){
      return com.singular.hijack.autofreq.SReaderApi.getSreaderInstance();
  }
  public void Start() {
      getSreaderInstance().Start();
  }
  
  public void Cancel() {
      getSreaderInstance().Cancel();
  }
  
  public void Stop() {
      getSreaderInstance().Stop();
  }
  
  public boolean Init() {
      return getSreaderInstance().Init();
  }
  
  public boolean isInit() {
      return getSreaderInstance().isInit();
  }
  
  public void SetMute(boolean param) {
      getSreaderInstance().SetMute(param);
  }
  
  public String GetErrorString() {
      return getSreaderInstance().GetErrorString();
  }
  
  public boolean Initial(long param) {
      return getSreaderInstance().Initial(param);
  }
  
  public String GetVersion(long param) {
      return getSreaderInstance().GetVersion(param);
  }
  
  public String GetKSN(long param) {
      return getSreaderInstance().GetKSN(param);
  }
  
  public String GetRandom(long param) {
      return getSreaderInstance().GetRandom(param);
  }
  
  public String ReadCard(long param) {
      return getSreaderInstance().ReadCard(param);
  }
  
  public String GetT1PAN(long param) {
      return getSreaderInstance().GetT1PAN(param);
  }
  
  public String GetT1HolderName_Exd(long param) {
      return getSreaderInstance().GetT1HolderName_Exd(param);
  }
  
  public String GetT2PAN(long param) {
      return getSreaderInstance().GetT2PAN(param);
  }
  
  public String GetT2Exd(long param) {
      return getSreaderInstance().GetT2Exd(param);
  }
  
  public String GenerateWorkingKey(String param, String param1) {
      return getSreaderInstance().GenerateWorkingKey(param,param1);
  }
  
  public String TriDesDecryption(String param, String param1) {
      return getSreaderInstance().TriDesDecryption(param,param1);
  }
  
  public boolean isSupported() {
      return true;
  }
  }
  </code></pre>
  
  <p>StateMachine :</p>
  
  <pre><code>Swipe swipe = (Swipe) NativeLookup.create(Swipe.class);
  appendText("swipe.obj == null :" + (swipe == null));//says false
  boolean bool = swipe.Initial(2500); **//THROW NULLPOINTER**
  appendText("swipe.Initial(2500):" + bool);
  boolean bool2 = swipe.isInit();
  appendText("swipe.isInit():" + bool2);
  </code></pre>