Back to project page vitdroid-android.
The source code is released under:
Apache License
If you think the Android project vitdroid-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.googlecode.android.widgets.DateSlider; import android.content.ContentValues; /*from w ww .j a va 2 s.com*/ import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; import android.widget.Toast; public class DBAdapterlinks { //public static final String KEY_DATETO="dateto"; //public static final String KEY_DATEFROM = "datefrom"; public static final String KEY_LINK = "link"; //public static final String KEY_HOLI = "holi"; private static final String TAG = "DBAdapter"; private static final String DATABASE_NAME = "links"; private static final String DATABASE_TABLE = "link"; private static final int DATABASE_VERSION = 1; private final Context context; private DatabaseHelper DBHelper; private SQLiteDatabase db; public DBAdapterlinks(Context ctx) { System.out.println("in Context"); this.context = ctx; DBHelper = new DatabaseHelper(context); } private static class DatabaseHelper extends SQLiteOpenHelper { DatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); System.out.println("IN DataHelper"); } public static final String DATABASE_CREATE="Create Table link(link varchar2(1000))"; //public static final String DATABASE_Query1="insert into Details values("anshul","","","","","","","","","","","","","","","","","");"; @Override public void onCreate(SQLiteDatabase db) { System.out.println("in calendar table oncreate outer"); try { db.execSQL(DATABASE_CREATE); System.out.println("In calendar tabe oncreate inner"); } catch (SQLException e) { e.printStackTrace(); } //global.acad_i=1; } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { System.out.println("in onupgrade"); Log.w(TAG, "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data"); db.execSQL("DROP TABLE IF EXISTS contacts"); onCreate(db); } } public void insertContact(String link) { System.out.println("In inserting contact of links values"); ContentValues initialValues = new ContentValues(); initialValues.put(KEY_LINK, link); //initialValues.put(KEY_DATETO, dateto); //initialValues.put(KEY_DESC, description); //initialValues.put(KEY_HOLI, holi); db.insert(DATABASE_TABLE, null, initialValues); } public DBAdapterlinks open() throws SQLException { System.out.println("Get Writable Database"); db = DBHelper.getWritableDatabase(); return this; } //---closes the database--- public void close() { System.out.println("In close"); DBHelper.close(); } /*public boolean deleteContact(long rowId) { return db.delete(DATABASE_TABLE, KEY_ROWID + "=" + rowId, null) > 0; }*/ //---retrieves all the contacts--- /*public Cursor getAllContacts() { //return db.query(DATABASE_TABLE, new String[] { KEY_SLOT,KEY_ROWID, // KEY_SUBJECT,KEY_FACULTY,KEY_FACULTYID,KEY_STUDENT,KEY_REGISTRATION,KEY_DATE1,KEY_DATE2,KEY_DATE3,KEY_DATE4,KEY_DATE5,KEY_DATE6,KEY_DATE7,KEY_DATE8,KEY_DATE9,KEY_DATE10,KEY_DATE11,KEY_DATE12,KEY_DATE13,KEY_DATE14,KEY_DATE15,KEY_DATE16,KEY_DATE17,KEY_DATE18,KEY_DATE19,KEY_DATE20,KEY_DATE21,KEY_DATE22,KEY_DATE23,KEY_DATE24,KEY_DATE25,KEY_DATE26,KEY_DATE27,KEY_DATE28,KEY_DATE29,KEY_DATE30}, null, null, null, null, null); /*return db.query(DATABASE_TABLE, new String[] {KEY_PASSWORD,KEY_ROWID, KEY_SLOT,KEY_SUBJECT, KEY_FACULTY,KEY_FACULTYID,KEY_STUDENT,KEY_REGISTRATION,KEY_DATE1,KEY_DATE2, KEY_DATE3,KEY_DATE4,KEY_DATE5,KEY_DATE6,KEY_DATE7,KEY_DATE8,KEY_DATE9, KEY_DATE10,KEY_DATE11,KEY_DATE12,KEY_DATE13,KEY_DATE14,KEY_DATE15,KEY_DATE16, KEY_DATE17,KEY_DATE18,KEY_DATE19,KEY_DATE20,KEY_DATE21,KEY_DATE22,KEY_DATE23, KEY_DATE24,KEY_DATE25,KEY_DATE26,KEY_DATE27,KEY_DATE28,KEY_DATE29,KEY_DATE30,KEY_MESSAGE}, null, null, null, null, null); */ //}*/ //---retrieves a particular contact--- /*public Cursor getContact(long rowId) throws SQLException { Cursor mCursor = db.query(true, DATABASE_TABLE, new String[] {KEY_ROWID, KEY_NAME, KEY_EMAIL}, KEY_ROWID + "=" + rowId, null, null, null, null, null); if (mCursor != null) { mCursor.moveToFirst(); } return mCursor; }*/ public boolean updateContact(long rowId, String name, String email) { ContentValues args = new ContentValues(); args.put(name, email); return false; } public Cursor getAllContacts() { System.out.println("in getallcontacts of calendar table"); //System.out.println(user_category); String q="Select * from link"; return db.rawQuery(q,null); } public Cursor getAllContacts2() { System.out.println("in adapter"); //System.out.println(user_category); String q="Select * from calendar_info"; return db.rawQuery(q,null); } public Cursor getDates() { // TODO Auto-generated method stub String q="Select * from calendar_info "; return db.rawQuery(q, null); } public void deleteDatabse() { context.deleteDatabase(DATABASE_NAME); //db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE ); } }