# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Methods | Inherited Methods

# NdefFormatable

`public final class NdefFormatable`
`extends Object` `implements TagTechnology`

java.lang.Object
↳ | android.nfc.tech.NdefFormatable

Provide access to NDEF format operations on a `Tag`.

Acquire a `NdefFormatable` object using `get(Tag)`.

Android devices with NFC must only enumerate and implement this class for tags for which it can format to NDEF.

Unfortunately the procedures to convert unformated tags to NDEF formatted tags are not specified by NFC Forum, and are not generally well-known. So there is no mandatory set of tags for which all Android devices with NFC must support `NdefFormatable`.

Note: Methods that perform I/O operations require the `Manifest.permission.NFC` permission.

## Summary

### Public methods
`void` | `close()` Disable I/O operations to the tag from this `TagTechnology` object, and release resources.
`void` | `connect()` Enable I/O operations to the tag from this `TagTechnology` object.
`void` | `format(NdefMessage firstMessage)` Format a tag as NDEF, and write a `NdefMessage`.
`void` | `formatReadOnly(NdefMessage firstMessage)` Formats a tag as NDEF, write a `NdefMessage`, and make read-only.
`static NdefFormatable` | `get(Tag tag)` Get an instance of `NdefFormatable` for the given tag.
`Tag` | `getTag()` Get the `Tag` object backing this `TagTechnology` object.
`boolean` | `isConnected()` Helper to indicate if I/O operations should be possible.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.
From interface `android.nfc.tech.TagTechnology`
`abstract void` | `close()` Disable I/O operations to the tag from this `TagTechnology` object, and release resources.
`abstract void` | `connect()` Enable I/O operations to the tag from this `TagTechnology` object.
`abstract Tag` | `getTag()` Get the `Tag` object backing this `TagTechnology` object.
`abstract boolean` | `isConnected()` Helper to indicate if I/O operations should be possible.
From interface `java.io.Closeable`
`abstract void` | `close()` Closes this stream and releases any system resources associated with it.
From interface `java.lang.AutoCloseable`
`abstract void` | `close()` Closes this resource, relinquishing any underlying resources.

## Public methods

### close

    public void close ()

Disable I/O operations to the tag from this `TagTechnology` object, and release resources.

Also causes all blocked I/O operations on other thread to be canceled and return with `IOException`.

Requires the `Manifest.permission.NFC` permission.

Throws
`IOException` |

### connect

    public void connect ()

Enable I/O operations to the tag from this `TagTechnology` object.

May cause RF activity and may block. Must not be called from the main application thread. A blocked call will be canceled with `IOException` by calling `close()` from another thread.

Only one `TagTechnology` object can be connected to a `Tag` at a time.

Applications must call `close()` when I/O operations are complete.

Requires the `Manifest.permission.NFC` permission.

Throws
`IOException` |

### format

    public void format (NdefMessage firstMessage)

Format a tag as NDEF, and write a `NdefMessage`.

This is a multi-step process, an IOException is thrown if any one step fails.

The card is left in a read-write state after this operation.

This is an I/O operation and will block until complete. It must not be called from the main application thread. A blocked call will be canceled with `IOException` if `close()` is called from another thread.

Requires the `Manifest.permission.NFC` permission.

Parameters
`firstMessage` | `NdefMessage`: the NDEF message to write after formatting, can be null

Throws
`TagLostException` | if the tag leaves the field
`IOException` | if there is an I/O failure, or the operation is canceled
`FormatException` | if the NDEF Message to write is malformed

### formatReadOnly

    public void formatReadOnly (NdefMessage firstMessage)

Formats a tag as NDEF, write a `NdefMessage`, and make read-only.

This is a multi-step process, an IOException is thrown if any one step fails.

The card is left in a read-only state if this method returns successfully.

This is an I/O operation and will block until complete. It must not be called from the main application thread. A blocked call will be canceled with `IOException` if `close()` is called from another thread.

Requires the `Manifest.permission.NFC` permission.

Parameters
`firstMessage` | `NdefMessage`: the NDEF message to write after formatting

Throws
`TagLostException` | if the tag leaves the field
`IOException` | if there is an I/O failure, or the operation is canceled
`FormatException` | if the NDEF Message to write is malformed

### get

    public static NdefFormatable get (Tag tag)

Get an instance of `NdefFormatable` for the given tag.

Does not cause any RF activity and does not block.

Returns null if `NdefFormatable` was not enumerated in `Tag#getTechList`. This indicates the tag is not NDEF formatable by this Android device.

Parameters
`tag` | `Tag`: an NDEF formatable tag

Returns
`NdefFormatable` | NDEF formatable object

### getTag

    public Tag getTag ()

Get the `Tag` object backing this `TagTechnology` object.

Returns
`Tag` | the `Tag` backing this `TagTechnology` object.

### isConnected

    public boolean isConnected ()

Helper to indicate if I/O operations should be possible.

Returns true if `connect()` has completed, and `close()` has not been called, and the `Tag` is not known to be out of range.

Does not cause RF activity, and does not block.

Returns
`boolean` | true if I/O operations should be possible

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*