Do I need to restart the emulator everytime I make an edit to the app I'm working on? Also I have c开发者_StackOverflow社区reated a databse in one of my apps and open this app in the same emulator each time. Each time I open the app does it create a new database on the emulator or when I close it and re open it is the database still there with all the stored values?
You will not need to restart the emulator each time, you can just push the new version of the APK to the device manually, or Eclipse will handle this automatically.
It will reuse the already created database unless you uninstall the application from the emulator or clear the application's data.
As Eclipse installs the application for you when you hit the "Play" Button, I usually use the command "adb uninstall my.app.name" to remove the application as it is faster than browse to the data folder and erase the database.
You don't need to restart the emulator every time you modify your code, just keep it open. In fact, even if you are using Eclipse, you don't need to start the emulator from inside the IDE, you can run it separately and Eclipse will find the running emulator. This is very useful when you need to run a custom kernel or a custom memory partition.
The emulator is, for all intensive purposes, like your phone.
So stopping and starting the emulator is like turning a phone off/on. The data in a database should remain persistent.
Also, don't keep re-starting the emulator. Way too slow.. By "Running" the application each time you make a change, will tell Eclipse to send a new APK file to the emulator. You can see the build and deployment in the Console occurring when you run the application. The emulator session continues to run, but a new APK file is deployed and launched.
If you encounter strange startup problems, try "Cleaning" the project as well.
It is not mandatory to restart emulator every time. It will use already existing database unless you install the app
精彩评论