Esempio di codice: creazione di un database SQLite crittografato

/* CreateEncryptedDatabase.java
*
* Research In Motion Limited proprietary and confidential
* Copyright Research In Motion Limited, 2010
*/
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.database.*;
import net.rim.device.api.io.*;
public class CreateEncryptedDatabase extends UiApplication
{
   public static void main(String[] args)
   {
      CreateEncryptedDatabase theApp = new CreateEncryptedDatabase(); 
      theApp.enterEventDispatcher();
   }
   public CreateEncryptedDatabase()
   { 
      pushScreen(new CreateEncryptedDatabaseScreen());
   }
}
class CreateEncryptedDatabaseScreen extends MainScreen
{
   Database d; 
   public CreateEncryptedDatabaseScreen()
   {
      LabelField title = new LabelField("SQLite Create Encrypted Database Sample",
      LabelField.ELLIPSIS |
      LabelField.USE_ALL_WIDTH);
      setTitle(title);
      add(new RichTextField("Creating an encrypted database called " +
      "MyEncryptedDatabase.db on the SDCard."));
      try
      {
         URI myURI = URI.create("file:///SDCard/Databases/SQLite_Guide/" +
         "MyEncryptedDatabase.db");
         DatabaseSecurityOptions dbso = new DatabaseSecurityOptions(true);
         d = DatabaseFactory.create(myURI,dbso);
         d.close();
      }
      catch ( Exception e )
      {
         System.out.println( e.getMessage() );
         e.printStackTrace();
      }
   }
}

Le informazioni sono state utili? Inviateci i vostri commenti.