Mobile project database, SQLite, replaced when the application starts

It is a mobile application for Android. I created a small database in which I want to store the user's preferences. Unfortunately, the database is deleted whenever the application is started in debug mode. This happens without code running at all.

The other strange thing is the database then gets recreated when my complete Manager of creation came, before a single line of code is executed. You can see in the code depending on whether it is where I start to use the database, but then again, the database is being destroyed and recreated before this code is reached.

Result: I lose anything stored in the database.

Any ideas why this happens?

<? XML version = "1.0" encoding = "utf - 8"? >
< s:View xmlns:fx = "http://ns.adobe.com/mxml/2009".
xmlns:s = "library://ns.adobe.com/flex/spark".
title = "HomeView.
creationComplete = "view1_creationCompleteHandler (event)" >

Remove creationComplete property, above and then just by running the application in debugging removes the database stored, without executing the function below.


< fx:Script >
<! [CDATA]
Import mx.events.FlexEvent;
public var sqlc:SQLConnection = new SqlConnection ();
public var db:File;

If this function is entered, the "Local Store" folder (under the applicationStorageDirectory),
and the database are deleted.

protected function view1_creationCompleteHandler(event:FlexEvent):void {}

stopping the trace statement following will always be to re-create an existing database.
even if end you the session of debugging is stopped at this point.
trace();

DB = File.applicationStorageDirectory.resolvePath ("MyDatabase.db");
Add the new headphones for attempting to open read/write:
sqlc.addEventListener (SQLEvent.OPEN, open_db_read_write_RESULT_event_handler);
sqlc.addEventListener (SQLErrorEvent.ERROR, open_db_read_write_ERROR_event_handler);
sqlc.openAsync (db)
}

private void open_db_read_write_RESULT_event_handler(event:SQLEvent):void {}
trace();
Remove the headphones:
sqlc.removeEventListener (SQLEvent.OPEN, open_db_read_write_RESULT_event_handler);
sqlc.removeEventListener (SQLErrorEvent.ERROR, open_db_read_write_ERROR_event_handler);

}

private void open_db_read_write_ERROR_event_handler(event:SQLErrorEvent):void {}
trace();
Remove the headphones:
sqlc.removeEventListener (SQLEvent.OPEN, open_db_read_write_RESULT_event_handler);
sqlc.removeEventListener (SQLErrorEvent.ERROR, open_db_read_write_ERROR_event_handler);
}
[]] >
< / fx:Script >
< fx:Declarations >
<! - Place non-visual elements (e.g., services, items of value) here - >
< / fx:Declarations >
< / s:View >

Flash Builder 4.5.1

Win 7

My path applicationStorageDirectory, where the database are created/retained:

C:\Documents and Settings\MyName\AppData\Roaming\testSQL.debug\Local store

Configure the run/debug panel uncheck the "clear the data application on each launch.

Tags: Flex

Similar Questions

  • How to set up the database restarts automatically when the server starts?

    Hello

    What is involved if I configure Oracle database starts automatically when the server is started/restarted?

    I guess that change the following entry in/etc/oratab
    DEVDB:/u01/app/oracle/product/10.2.0/db_1:N
    TO
    DEVDB:/u01/app/oracle/product/10.2.0/db_1:Y
    is not sufficient - there is more than that. But what is it?

    We can also configure the listener to automatically re / start?

    I guess that everything what is the solution, it will also apply to Oracle 11 GR 2 databases/ASM - right?

    The platform is Redhat Linux 64 bit (version 4.7 & v5.9).

    Thanks in advance!

    Best regards

    Hello

    Below is one example of autostart services database and the listener.

    1 > make/etc/oratab file entry Y as:
    ORCL:/U01/app/Oracle/product/10.2.0/Db_1:Y

    2 > create a file called "/ etc/rc.d/init.d/oracle" as root, containing the following.
    --------------------------------------
    #! / bin/sh
    # chkconfig: 345 99 10
    Description #: Oracle automatic start-stop script.
    #
    # Define ORA_HOME as equivalent to the $ORACLE_HOME
    # from which you want to run dbstart and dbshut;
    #
    # Define ORA_OWNER to the userid of the owner of the
    # Oracle in ORA_HOME server.

    ORA_HOME=/U01/app/Oracle/product/10.2.0/Db_1
    ORA_OWNER = oracle

    If [! f $ORA_HOME/bin/dbstart]
    then
    echo "Oracle startup: cannot start.
    output
    FI

    case '$1' in
    'Start')
    # Run Oracle databases:
    # The following command assumes that the oracle connection
    # will not prompt the user for all values
    known - $ORA_OWNER - c "start ORA_HOME/bin/lsnrctl $".
    known - $ORA_OWNER - c $ORA_HOME/bin/dbstart
    ;;
    'stop')
    # Stop the Oracle databases:
    # The following command assumes that the oracle connection
    # will not prompt the user for all values
    known - $ORA_OWNER - c $ORA_HOME/bin/dbshut
    known - $ORA_OWNER - c "ORA_HOME/bin/lsnrctl stop $.
    ;;
    ESAC
    -------------------------------------------------

    3 > use the chmod command to set privileges to 755.
    chmod 755 /etc/rc.d/init.d/oracle

    4 > associate the appropriate oracle service run levels and set it to auto-start by using the following command.
    chkconfig--level 345 oracle on

    Note:-back, I've done this for a long time... Please check the dbstart use pfile or spfile to start the database instance.
    Thank you

  • Events when the application starts

    At the start of my program, I need the user to enter two strings that are then used in the structures of the event. I have created a for this dialog box.

    In addition, if these strings must be changed during execution of the program, I have a button that fires an event value that made up the same dialog to change, then these new values are used through shift to other events registers.

    Is there a way to add a start of application event to the value of the button change event so that the sequence of the program is:

    Open the program

    the dialog box appears

    the user between two strings

    ... the main program using these values...

    the user clicks button changes to the

    the dialog box appears

    the user enters two new channels

    ... the main program using the new values.

    etc...

    Right now I do the first three steps outside the main program loop and there is a value change event that does exactly the same thing in the loop. This doesn't seem to be the most effective way of doing things.

    Kind regards

    Sebster.

    A simple solution is to write to a signaling of the value property of the button before the start of the loop.

    This will be the event queue and fire as soon as the structure of the event is ready to run.

    (To use it, you must create your badge is the switch and put it back to false in the event).

    Here's how it might look:

  • How do 'Enum Control' disabled during the execution of an executable application and make activated when the application is stopped/abandoned?

    Hello

    I use a "Enum control" on the façade of an executable application built with application builder for LabVIEW 2013 full professional development system. I want Enum control remains activated prior to execution of this request so that I can choose any value from the list of available numeric values, but when I run this application; Enum control should become disabled so that the user can not select another value in the list of data during application execution values so that the default setting remains unchanged during the execution of this application. Enum control must also be activated when the application is stopped/abandoned so that the user can select any value.

    Could someone pls suggest a solution to this problem?  If I select the active state' to 'Disabled' in appearance tab then all listed values becomes disabled.

    Concerning

    Jamal

    I suggest to use the node property of persons with reduced mobility.  You can then disable the enum at the beginning of the program and then activate it in the judgment.

  • Printing of the .pdf of the 2013 project file will stop when the name of the file must be written. Project 2013 crashes. Anyone know what the problem is between 2013 project and Adobe Acrobat 9?

    Printing of the .pdf of the 2013 project file will stop when the name of the file must be written. Project 2013 crashes. Anyone know what the problem is between 2013 project and Adobe Acrobat 9?

    The family of products Acrobat 9.x passed in mid-2013 "end of Support".
    Using Acrobat 9 of MS Project via PDFMaker stops with Office 2007.
    To 2013 Office support, you must use Acrobat XI (11.0.1) or newer.

    A good reference:
    https://helpx.Adobe.com/Acrobat/KB/compatible-Web-browsers-PDFMaker-applications.html

    Acrobat Pro and Standard DC are what are currently available for purchase.

    Be well...

  • Skype rings only when the application is open

    I have a Skype number for my phone a few days ago and I just noticed a problem. When people try to call me using my Skype number, it sounds only when the application is open and the phone is unlocked. However, people can still call me normally on my Skype ID, it is locked or not currently open to the app. It's a rule I missed when having a Skype number?

    I reset my phone to factory settings and it works now.

  • Skype number rings only when the application is open

    I have a Skype number for my phone a few days ago and I just noticed a problem. When people try to call me using my Skype number, it sounds only when the application is open and the phone is unlocked. However, people can still call me normally on my Skype ID, it is locked or not currently open to the app. It's a rule I missed when with a Skype number?

    (Previously posted this in the Android subforum)

    I reset my phone to factory settings and it works now.

  • toggle is plotted on a graph when the application is running

    Hello

    I'm trying to figure out how to make a graph that allows the user to select which elements are drawn when the application runs.  I want all data to appear on the same graph with the same x and axis of ordinates and maybe some checked boxes or something to allow easily what items are displayed.

    Thank you

    Gary

    1... don't use two nodes in separate property for the PLOT VISIBLE and Act implementation CHART.  If you do that, you don't know who runs first, - they are independent.  Use a single property node (stretch it to include two properties).  The top property must be ACTPLOT, 2nd one, be VISIBLE TRACE.  In this way, it is guaranteed to run in the order you need.

    2 you are the cluster of box check ONCE at the beginning of the program of reading and using the same value each time.  You want to read the cluster when the CHANGE occurs, EVENT that is, in the case of the EVENT.  You can read the terminal, or read the NEW VALUE property for the event, so be it is OK.  But you have to read the new value, not the old one.

    3... you also read your buttons ONCE at the beginning of the program, and re - trace the same value whenever you draw. You need to know when you need to draw and THEN read them and lead the chart.

    4... If you set the timeout to, say, 100 mSec, in the TIMEOUT case, read the buttons and drive the graph, then you will have a living picture that updates approximately every 100 milliseconds.  Implement #1 and #2, and you can turn on and outside plots.

    I say "Roughly" because of the way the timeout works - if you wait 99 mSec and then click on a checkbox, the wins Manager check box and the timer 100mSec STARTS OVER when you get to the next iteration.

    If you want the table to day exactly every 100 msec and then use time separate loop, with a WAIT TIL NEXT MSEC MULTIPLE.  Do the waiting, read buttons, drive chart and repeat.  A separate loop will not be disturbed by events in the loop of the user interface.

  • Push notification when the application is closed

    Hello! I want to recive notify with my application when the application is closed.

    is this possible? An example of code for this?

    Kind regards!

    Sorry, with sample collector push, can result.

    Thank you!

  • When the application is removed

    Hello

    How will I know when the application is removed

    make a wish of application registry in are on start .i want to cancel the phone from the server on the uninstall.

    In addition to a second request for guard dog, the only approach I am aware to do this was the CodeModuleListener added in OS 5.0.  Take a look at this and search the forum for other users who have tried it.  I'm not sure it works as well as we would like.

  • Warn when the application moves to the State active or inactive?

    I can't find the right search words.  I want to be notified when the application becomes idle / reduced due to:

    user, reducing to the minimum the app

    When the unit is put or paused

    I also want to know when:

    App become active / goes to the foreground

    How can I check for these events?

    Hello! Check the Application signals: instance() in Application.hpp:

    void thumbnail();
    fullscreen() Sub;
    void invisible();
    void asleep();
    void awake();

  • Notification when the Application in the foreground changes?

    Is it possible to get a notification when the application in the foreground changes?  For example, if the user launches the browser, can my application be notified?  I couldn't see anything through the global event listener callback.  I know it is possible to query for this application, but is not ideal.

    Jacul is right, you get notifications on your application becomes the application in the foreground (and vice versa) but there is no way to get this information on other applications.

  • Prevent the PlayBook goes into mode standby when the application is open

    What is the code needed to prevent the PlayBook mode 'sleep' when the application is active?

    Maybe this can help: https://github.com/blackberry/WebWorks-Community-APIs/tree/master/Tablet/sleep

  • Global dialogue - show when the application is in the background

    I have a function that opens a dialog for the user and the user must choose one of two options. The thing is, this function can be called when the user press a certain button, or when the application is in the background. So, to do this, I use the following code:

    synchronized(Application.getEventLock()){
                final Dialog d = new Dialog(Dialog.D_YES_NO, msg,
                        Dialog.NO, Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION), Manager.VERTICAL_SCROLL);
                // So I would identify it as a Dialog
                if ( Application.isEventDispatchThread() ) {
                    // We have the Event Thread, can just show the Dialog
                    UiApplication.getUiApplication().pushModalScreen(d);
                } else {
                    // running in background
                    UiApplication.getUiApplication().invokeAndWait(new Runnable() {
                    public void run() {
                        NotificationsManager.triggerImmediateEvent(ID, 0, null, null);
                        UiApplication.getUiApplication().pushGlobalScreen(d, 1, UiEngine.GLOBAL_MODAL);
                        NotificationsManager.cancelImmediateEvent(ID, 0, null, null);
                        }
                    });
                }
                return ( d.getSelectedValue() == Dialog.YES );
            }
    

    It works very well when the user presses the button that calls this function. However, when the function is called when the application is in the background, nothing happens.

    If you tap on the icon of the app again, it doensn can't have launched, the debugger says the application application forground and if he says so it is already running and doesn't anything. If the application crashes and you can't access.

    How can I solve this problem and make the pop up dialog box to the user evern if the application is not to the point?

    Thank you for your time.

    I had problems with invokeAndWait() gel all that precedes. Unless you really need, I would use invokeLater().

  • Delete PersistentObject of the store when the application is uninstalled

    Hello

    I expect that on request, uninstall the PersistentObjects used by the application would be removed, but this does not happen.

    How can I achieve it

    Thanks yo

    If you create a custom class that is persistable your persistent data will be deleted when the application is uninstalled.  If you use a class set of BlackBerry APIs, such as String and store in the persistent store, it is not deleted when the application is uninstalled.  This is explained here:

    Manage the data recorded during the withdrawal of an application

    http://supportforums.BlackBerry.com/T5/testing-and-deployment/handle-stored-data-when-removing-an-AP...

Maybe you are looking for

  • Time machine backs up only 5 GB?

    Hello I have an external hard drive that I've implemented a Time Machine drive and I make monthly backups to it. This is my second time back up my MacBook Pro, but the backup has been only 5GBs and it took 15 minutes while my first backup was 250GBs

  • The file name change DSC?

    Is it possible to change the name of files image of DSC to something else? I work with a pair of Sony, an a6000 and a NEX-6. When their number sequence matching, it's a pain to edit photos. With my Nikon DSLR, I am able to change the name. This preve

  • The amber light flashes on my Satellite L755

    Hello Mr President I have the Toshiba Satellite laptop L755 came from Finland in 2011. I use last 4 years now and it worked fine, but since there is a few months on and the charging light started to blink a few times it s late start or sometimes soun

  • HP 15: start-up goes into Office, not the menu mode START

    So I think this might be a frivolous job, after my upgrade to windows 10 8.1, my laptop comes in DESKTOP mode instead of the START MENU mode. Is this normal or have I done something wrong? W.P. "Bill" Marshall

  • Cannot replace the PXI embedded clock with clock oscillator PXI-6682 on PXI back plane

    I installed a module of synchronization PXI-6682 to slot 2 of a PXI-1031chassis with a PXI-8110 controller running hypervisor and RT.  The 6682 is installed on the RT system hypervisor for GPS sync during the measurements, but I would like to ask the