Implemented getSize() to return max ndef size.

Change-Id: Ia584e8cfa51a4eaef5f03dc436c78a67296c2cae
This commit is contained in:
Martijn Coenen
2010-12-07 14:04:28 -08:00
committed by Nick Pelly
parent 42a23783aa
commit 6d9fc7e1ef

View File

@@ -47,12 +47,22 @@ public final class Ndef extends BasicTagTechnology {
/** @hide */
public static final String EXTRA_NDEF_MSG = "ndefmsg";
/** @hide */
public static final String EXTRA_NDEF_MAXLENGTH = "ndefmaxlength";
private final int maxNdefSize;
/**
* Internal constructor, to be used by NfcAdapter
* @hide
*/
public Ndef(NfcAdapter adapter, Tag tag, int tech, Bundle extras) throws RemoteException {
super(adapter, tag, tech);
if (extras != null) {
maxNdefSize = extras.getInt(EXTRA_NDEF_MAXLENGTH);
} else {
maxNdefSize = 0; //TODO: throw exception
}
}
/**
@@ -95,7 +105,7 @@ public final class Ndef extends BasicTagTechnology {
* Get maximum NDEF message size in bytes
*/
public int getSize() {
throw new UnsupportedOperationException();
return maxNdefSize;
}
/**