hi there
i am designing an application using NFC with a Nexus phone. i am starting 
from a working sample code, which i purged to have a working template to 
begin with
the project compile w/o (compile time) errors.
i am getting the following runtime errors when executing the method 
getApplication (see >>>>> below)
the error reported by eclipse LogCat is rather obscure as following

12-29 14:49:04.542: E/AndroidRuntime(9230): at 
java.lang.reflect.Method.invoke(Method.java:507)
12-29 14:49:04.542: E/AndroidRuntime(9230): at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-29 14:49:04.542: E/AndroidRuntime(9230): at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-29 14:49:04.542: E/AndroidRuntime(9230): at 
dalvik.system.NativeStart.main(Native Method)

here is the relevant code

public void onCreate(Bundle icicle) {
super.onCreate(icicle);
        ....
mAdapter = NfcAdapter.getDefaultAdapter(this);
        mPendingIntent = PendingIntent.getActivity(this, 0,
                new Intent(this, 
getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
        IntentFilter ndef = new 
IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED);
        mFilters = new IntentFilter[] {ndef,};

        mTechLists = new String[][] { new String[] { 
android.nfc.tech.NfcV.class.getName() } };
....
    public void onNewIntent(Intent intent) {
       Log.i("Foreground dispatch", "Discovered tag with intent: " + 
intent);
       Tag tagFromIntent = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); 
            
>>>>>       myApplication ma = (myApplication)getApplication();
       ma.setCurrentTag(tagFromIntent);
     Intent newIntent = new Intent(ecmAppActivity.this, 
com.efesys.ecmApp.progEcmActivity.class);
     startActivity(newIntent);
       return;
}
...
myApplication is just this class

public class myApplication extends Application {

private Tag currentTag;
private byte currentDelay;
private byte currentOverwrite;
private byte[] configuration;
/*
private int nbOfAcquiredTemp;
private double currentTemp;
private float maxTemp;
private float minTemp;
private float avgTemp;
private ArrayList<double[]> arrayTemp ;
private ArrayList<double[]> arrayAxis ;
private boolean dataCorrupted;
private boolean graphDownloadedOnceWithoutError= false;
*/
public byte[] getConfiguration() {
return configuration;
}


public void setConfiguration(byte[] configuration) {
this.configuration = configuration;
return;
}
public byte getCurrentOverwrite() {
return currentOverwrite;
}

public void setCurrentOverwrite(byte currentOverwrite) {
this.currentOverwrite = currentOverwrite;
}

public byte getCurrentDelay() {
return currentDelay;
}

public void setCurrentDelay(byte currentDelay) {
this.currentDelay = currentDelay;
}


public Tag getCurrentTag() {
return currentTag;
}

public void setCurrentTag(Tag currentTag) {
this.currentTag = currentTag;
        return;
}

}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to