Featured post
android - Database to create a database -
i'm using sqlite android develop , app can customizable (for dev) in future. have created database data used create database application. if changes need made in future or write app else in future have change original database. idea behind dev's database set ui , app.
i stuck on next have database need in app dev populated. idea create dbhelper class , within reference original dbhelper class , query within new db class. second dbhelper class i'm trying create database previous database:
public class appdbhelper extends sqliteopenhelper { private static final string database_name = "library.db"; //database name cursor all, tables, options, ui_type; sqlitedatabase database; public appdbhelper(context context) { super(context, database_name, null, 1); dbhandler databasehelper = new dbhandler(context); database = databasehelper.getreadabledatabase(); = database.rawquery("select * config", null); tables = database.rawquery("select * table_names", null); options = database.rawquery("select * options", null); ui_type = database.rawquery("select * ui_type", null); } @override public void oncreate(sqlitedatabase db) { for(int i=0; i<tables.getcount(); i++){ tables.movetoposition(i+1); string sql = ""; for(int j = 0; < all.getcount(); j++){ if (all.movetofirst()) { do{ sql = ", " + all.getstring(2) + " " + all.getstring(5).touppercase(); } while (all.movetonext()); } } log.v("databasesql", sql); database.execsql( "create table " + tables.getstring(1) + "(_id integer primary key autoincrement"+sql+");"); } }
but have feeling not way go need do. appreciated.
i think wrong , complicated. provide database read data create inserts , configuration implemented.
two solutions:
from own project: databaseadapter.oncreate()
there should see database setup , filling of database data. data added simple inserts contains data based on constants. programmer can change data changing constants.
with don't have handle 2 databases, don't need provide database , read them.
as android supports database locations skip , open sqlite database file provide in res/raw or asset folder or anywhere on sdcard.
i recommend 1 of 2 ways mentioned above.
- Get link
- X
- Other Apps
Comments
Post a Comment