Android Open Source - schat My S Q Lite Helper






From Project

Back to project page schat.

License

The source code is released under:

MIT License

If you think the Android project schat listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.data;
/*w ww  . j  a v a  2  s .co m*/
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

/**
 * Maintains a database
 * For more references: <a href>http://www.vogella.com/articles/AndroidSQLite/article.html#sqliteoverview_packages</a>
 */
public class MySQLiteHelper extends SQLiteOpenHelper {
    private static final String DATABASE_NAME = "contacts.db";
    private static final int DATABASE_VERSION = 1;

    public MySQLiteHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String sqlScript;
        try {
            sqlScript = new Scanner(new File("contacts.sql")).useDelimiter("\\A").next();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            return;
        }
        String[] sqlQueries = sqlScript.split(";");
        for (String query : sqlQueries) {
            db.execSQL(query);
        }
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        Log.w(MySQLiteHelper.class.getName(),
                "Upgrading database from version " + oldVersion + " to " +
                        newVersion + ", which will destroy all old data");
        onCreate(db);
    }

}




Java Source Code List

.ServerMain.java
com.activities.Activity_Chat.java
com.activities.Activity_ContactList.java
com.activities.ContactView.java
com.data.AddContact.java
com.data.AndroidSQLManager.java
com.data.ApplicationUser.java
com.data.ChatAdapter.java
com.data.ChatArrayList.java
com.data.MySQLiteHelper.java
com.security.AndroidKeyPairManager.java
com.security.PRNGFixes.java
com.services.MessageService.java
crypto.CryptoConstants.java
crypto.Cryptography.java
crypto.Envelope.java
crypto.SecureMessage.java
crypto.TestCrypto.java
data.ChatMessage.java
data.Content.java
data.DatabaseManager.java
data.KeyPairManager.java
data.Message.java
data.SQLiteManager.java
data.User.java
data.contents.ChatContent.java
data.contents.LoginSuccess.java
data.contents.Login.java
data.contents.PublicKeyRequest.java
data.contents.PublicKeyResponse.java
data.contents.Registration.java
networking.SChatClientListener.java
networking.SChatClientWriter.java
networking.SChatClient.java
networking.SChatServerThread.java
networking.SChatServer.java