Troubleshooting guide
88
BlackBerry Java Development Environment Development Guide
Add support for backing up data with the BlackBerry Desktop Software
Task Steps
Let your application maintain a
collection of synchronized objects,
producing and processing valid
synchronization data when creating a
SyncObject.
Implement the SyncCollection and SyncConverter interfaces by the same class or by separate
classes, depending on the design of the application.
> Change the main class for the application to implement the SyncCollection and
SyncConverter interfaces.
public class RestaurantsSync extends UiApplication implements
RestaurantsSyncResource,SyncCollection, SyncConverter
Let persistable objects be
synchronization objects.
> Modifiy a class that implements the Persistable interface to implement the SyncObject
interface.
private static final class RestaurantInfo implements Persistable,
SyncObject
Create a unique ID for a
synchronization object.
> In the persistable class, create an instance variable for storing a unique ID for synchronization
operations.
private int _uid;
Let your main application retrieve the
unique ID of the synchronization
object.
> In the persistable class, implement the getUID() method to return a unique ID for
synchronization operations.
public int getUID() {
return _uid;
}
Let your main application create a
synchronization object using a unique
ID.
> In the persistable class, create a constructor that accepts a unique ID as a parameter and sets the
_uid variable to this value.
public RestaurantInfo(int uid) {
_elements = new String[4];
for (int i = 0; i < _elements.length; ++i) {
_elements[i] = "";
}
_uid = uid;
}