Seven, the sixth day of Android learning--sqlite and file download

Source: Internet
Author: User

(Transferred from: http://wenku.baidu.com/view/af39b3164431b90d6c85c72f.html)

Seven, the sixth day of Android learning--sqlite and file download
    • Sqlite

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.

    • Program debugging

(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

    • File download

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.