public method IO2GResponseListener.onTablesUpdates
Brief
Processes notifications about tables updates.
Declaration | ||||
|
Parameters | |
data |
The response object. It is provided by the server as a result of trading tables updates. The type of this response is O2GResponseType.TABLES_UPDATES. You must use the O2GResponseReaderFactory. createTablesUpdatesReader method to process this response and to create the O2GTablesUpdatesReader object. For details, see the example below. |
Details
In order to process notifications about tables updates, an instance of the class implementing the IO2GResponseListener interface
must be subscribed to a session object.
It is accomplished by calling the O2GSession
.subscribeResponse
method.
Note: If your application uses the O2GTableManager, processing of tables updates is done in methods of the class that implements the IO2GTableListener interface.
Example
Process notifications about live offer updates [hide]
// Implementation of IO2GResponseListener interface public method onTablesUpdates public void onTablesUpdates(O2GResponse response) { O2GResponseReaderFactory factory = mSession.getResponseReaderFactory(); if (factory == null) { return; } O2GTablesUpdatesReader updatesReader = factory.createTablesUpdatesReader(response); for (int i = 0; i < updatesReader.size(); i++) { O2GTableType tableType = updatesReader.getUpdateTable(i); if (tableType == O2GTableType.OFFERS) { O2GOfferRow offer = updatesReader.getOfferRow(i); System.out.println(" This is a live update: \nInstrument = " + offer.getInstrument() + " Bid = " + offer.getBid() + " Ask = " + offer.getAsk()); } } } }
Declared in IO2GResponseListener