Android Tutorial Android SQLite Viewer

Discussion in 'Tutorials & Examples' started by Erel, May 17, 2011.

  1. Erel

    Erel Administrator Staff Member Licensed User

    SQLite Viewer is an open source application that allows you to view the contents of SQLite databases right from your Android device.

    [​IMG]

    [​IMG]

    Choosing the database file is done with an external file manager or with agraham's FileDialog.

    After choosing a database file, you will see a list with the database tables. Choosing a table will open the second activity which shows the table fields types and the table contents.

    BLOB columns will display: "click to see image".
    When you click on such a cell the program will try to convert the BLOB data to an image and show it.

    [​IMG]

    The code uses DBUtils code module for most of the SQL statements.
    Handling the BLOB columns adds some complexity. You can see it handled in TableActivity code.
    The source code is included in the zip file.
     

    Attached Files:

    Last edited: Mar 18, 2018
  2. Merlot2309

    Merlot2309 Active Member Licensed User

    Erel,

    A very useful tool for SQLite databases.
    Thank you.

    Helen.
     
    Last edited: May 17, 2011
  3. Filippo

    Filippo Expert Licensed User

    Hi Erel,

    Many many thanks, have been waiting a long time. :sign0060:

    :sign0098:
     
  4. aklisiewicz

    aklisiewicz Active Member Licensed User

    While compiling this example I get following error
    ===============================================
    Compiling code. Error
    Error parsing program.
    Error description: Unknown type: filedialog
    Are you missing a library reference?
    Occurred on line: 13
    Dim FileDialog1 As FileDialog
    ===============================================
    seems like I'm missing some library. Is there any way to download all available libraries and install all of the in one step, so I don't have to search for it every time I want to run some example app ? I think it should be a matter of good habit to include information with the example if any extra library is necessary to compile.

    Thanks - Arthur
     
    Last edited: May 31, 2011
  5. Erel

    Erel Administrator Staff Member Licensed User

    You are missing agraham's Dialogs library. Didn't you get an error when you opened the project?

    The documentation page lists all objects types. You can search for FileDialog and then it will take you to its library.
     
  6. aklisiewicz

    aklisiewicz Active Member Licensed User

    no I did not get an error upon opening, but rather on compliling. I have found it and installed, mentioned library but I her the following error:

    Compiling code. Error
    Error parsing program.
    Error description: Unknown type: contentchooser
    Are you missing a library reference?
    Occurred on line: 5
    Dim cc As ContentChooser

    I can't locate any library like ContentChooser

    Arthur
     
    Last edited: May 31, 2011
  7. Erel

    Erel Administrator Staff Member Licensed User

    Have you changed any code? Is it loading the blue layout?
     
  8. Rusty

    Rusty Well-Known Member Licensed User

    I too, had this problem. Where can I find the FileDialog1 library or code? I made no changes to the project included in the zip file. Thanks
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    The FileDialog is part of the Dialogs library and the ContentChooser is part of the Phone library.
     
  10. kickaha

    kickaha Well-Known Member Licensed User

    ContentChooser is part of the Phone library, ensure this is selected in the "libs" tab of the IDE.

    The search function at the top of this page works guys:sign0060:
     
  11. AscySoft

    AscySoft Active Member Licensed User

    Not working!? I know is me, but why? Here's the error:

    Compiling code.
    Error parsing program.
    Error description: Unknown type: filedialog
    Are you missing a library reference?
    Occurred on line: 13
    Dim FileDialog1 As FileDialog

    Why is not working? In libs tab I've got all the 3 libs checked(core.phone,sql)
     
  12. AscySoft

    AscySoft Active Member Licensed User

    Sorry, false alarm. I wasn't paying attention to the first posts...My bad
    :sign0013:
    I installed Dialogs Library 2.3 and now is working perfectly! Thanks
     
  13. Harris

    Harris Well-Known Member Licensed User

    Weird..

    I just tried the "apk" on my device (Flytouch 2).

    It uses the filemanager and I can choose internal or external storage.
    It opens the internal db with no problem, shows the contents of any table and images stored in blobs.

    When I try to open the same db on the SD card, I get a toastmessage - "Error opening db" - and nothing shows.... The db is intact because my app uses it without any problems.

    Thanks
     
  14. Erel

    Erel Administrator Staff Member Licensed User

    You can remove the Try / Catch code in LoadDatabase. Try to load the database and check the error message.
     
  15. oleman108

    oleman108 Member Licensed User

    I have the same problem like aklisiewicz and in addition I am not finding this Dialogs library. It does not show in the Libs Tab. How can I reference this library?
    Thanks for :sign0085: to a newbie, Oliver
     
  16. klaus

    klaus Expert Licensed User

    Here.

    Best regards.
     
  17. tcgoh

    tcgoh Active Member Licensed User

    Hi,

    How do I upload a database file to the emulator?

    Thanks
     
  18. Erel

    Erel Administrator Staff Member Licensed User

  19. tamadon

    tamadon Active Member Licensed User

    I created a sample database using SQLite manager Firefox addon. I can read the content fine when I have like 4 entries but when I have 10 entries I can no longer view the table list.

    The table consists of 7 columns: ID, BLOP1, TEXT1, TEXT2, TEXT3, TEXT4, BLOP2. The database size is only 1120KB.

    This problem only occur in the emulator, the emulator has 16MB SDcard. However I can view the tables using a real device.

    What am I missing?

    Thanks in advance for the help.
     
  20. tamadon

    tamadon Active Member Licensed User

    Attached is the sample database. SQLiteViewer can read that but when I add more record, the table is no longer readable.

    I've increased the Max application heap size to 64 and the SD Card size to 1GB but those don't help either.

    Any ideas?
     
    Last edited: May 16, 2012
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice