(Transferred from: http://wenku.baidu.com/view/af39b3164431b90d6c85c72f.html)
Seven, the sixth day of Android learning--sqlite and file download
SQLite is a very small relational database embedded in Android.
Summary: When we operate
In the study of SQLite, encountered two questions:
(a) If we succeed in setting up the Android environment, after entering ADB on the command line, there is no response, you can do it by clicking on the following:
The first step: Add the directory of the Platform-tools to the configuration of the PATH environment variable;
Step two: Copy the Adb.exe and two DLL files under Platform-tools to the Tools directory
Step Three: Restart the command line, enter ADB, fix
(ii) Results after entering the ADB shell command, after configuring the path variable as above, the device not found is prompted.
The reason for this error is that it was not connected to the phone so error, in the development of Android, because the Android virtual machine is not running and error, we just need to run the Android virtual machine in Eclipse to access.
According to Mars teacher said, SQLite in the development process will appear some of the more eccentric problems, so it is recommended not to store too much data in sqlite, not too dependent on SQLite.
(a) You can add some system.out statements in moderation to detect the operation of the program.
(ii) Use of log input (log)-The practice of recommending the use of this specification
To implement the ability to download files, the general steps are:
(i) Create a HttpURLConnection object
URL url = new URL ("http://...");
HttpURLConnection urlconn = (httpurlconnection) url.openconnection ();
(ii) Acquisition of InputStream objects
Urlconn.getinputstream ();
(iii) access to the network
Android:permission. INTERNET
To access the phone sdcard steps:
(i) Get the current device SD card directory
Environment.getexternalstoragedirectory ();
(ii) Access to the SD card
Android.permission.WRITE_EXTERNAL_STORAGE
Problems encountered:
When writing a good download program, but how also download unsuccessful, the original is to forget the most important step:
Don't end up adding the following two lines of code to the manifest.xml to give permission:
<!--The following two sentences are necessary in the download, the first is to give the download permission, the second is to give the right to write to the SD card--
<uses-permission android:name= "Android.permission.INTERNET"/>
<uses-permission android:name= "Android.permission.WRITE_EXTERNAL_STORAGE"/>
Seven, the sixth day of Android learning--sqlite and file download (turn)