Okhelp.cz

Recepty, články, nápady, programování. Dříve dum-zahrada, finance, internet a know-how.okhelp.cz Pro lepší výsledky hledání používejte i diakritiku.

Sqlite create database and table with BAT file for Android


Sqlite3 create database and table with load.bat file and fill data to table example.


  1. Create folder for your project: my_sqlite_project

  2. Open folder and create file load.bat and paste to load.bat this text and save to project folder:


    sqlite3 my_database.s3db < load_text.sql
    pause



  3. Create load_text.sql file and paste this text and save to project folder:

    CREATE TABLE [android_metadata] (
    [locale] TEXT
    );




    CREATE TABLE [my_table] (
    [_id] int NULL,
    [word] VARCHAR(255) NULL,
    [description] VARCHAR(255) NULL




    .separator ";"
    .import text_file.txt my_table


  4. Create text_file.txt and paste this text and save it as UTF-8:

    1;word1;my first word
    2;word2; my second word



  5. Download sqlite3.exe and put to project folder.

  6. Run BAT file load.bat and read text instruction from console

  7. If database created you can open and edit this with sqlite database explorer

  8. Copy database to Asses Android project folder

  9. If you want using this database in Android application on device, you have to copy this database to folder on device /data/data/com.MyPackage/databases/










397LW NO topic_id



Další témata ....(Topics)


19

How set focus on View Android development example | how-set-focus-on-view-android-development-example


Set focus on a View in Android application example source code for Button, EditText, View, TextView, isFocused(), requestFocus() .


// set focus on Button Android example
 private Button mRightButton;
 mRightButton = (Button) a.findViewById(R.id.rightButton);
 mRightButton.requestFocus();
// boolean isFocused() 
boolean b = mRightButton.isFocused(); // true or false

// set focus on TextView directly Android example
((TextView) findViewById(R.id.myText)).requestFocus();

// set focus on View Android example
private View mView;
mView = findViewById(R.id.showAll);
mView.requestFocus();

// set focus on EditText Android example
private EditText mEdit;
mEdit = (EditText)findViewById(R.id.myEdit);
mEdit.requestFocus();
127

Force Screen On - dont use WakeLock - use getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) - Android sample | force-screen-on-dont-use-wakelock-use-getwindow-addflagswindowmanager-layoutparams-flag_keep_screen_on-android-sample


FLAG_KEEP_SCREEN_ON saving energy. Protects the battery if a user closing applications using the Return button on device. The device will returned to user screen mode settings.

@Override
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        //..........
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    }
14

SQLite explorer download | sqlite-explorer-download


Best of SQLite explorer and admin download for SQLite 2.x and SQLite 3.x in separated folders.

Download Explorers SQLite 2.x and SQLite 3.x in separated folders
360

Resource Entry already defined | resource-entry-already-defined


Check if in drawable folder have two picture with same name and delete one.
For example:

image_1.jpg
image_1.png


Check the module build folder in Android Studio for two files with same names.

C:\Users\myFolder\AndroidStudioProjects\Project\yourModule\build\intermediates\res\merged\debug\drawable\
269

Eclipse revert old version Android Development Tools | eclipse-revert-old-version-android-development-tools


If you have trouble with compilation of new project after you make a update of android development tools you can go back to old version of the tools.




    • Open Help > About Eclipse... use the menu > About...

    • Click the "Installation Details" button.

    • Select the "Installation History" tab.

    • Select one of the previous configurations.

    • Click the "Revert" button at the bottom.





eclipse-revert-android-development-tools-1

eclipse-revert-android-development-tools-2




Editace: 2011-09-26 20:47:35
Počet článků v kategorii: 397
Url:sqlite-create-database-and-table-with-bat-file
Share
Share
Tweet