Android file storage (at the end of the article there are eggs)

Source: Internet
Author: User
Tags sqlite database

1. I/O flow is divided into Byte streamAnd character Stream
      • BYTE stream: InputStream, outputstream (input stream, output stream)
      • Character streams: Reader, Writer (input stream, output stream)

Note: 1 characters = 2 bytes

Buffered streams: BufferedReader, BufferedWriter (buffered input, output stream) 2. Open the database: sqlite3; 3. Modify File PermissionsCHOMDExample: chomd+ 777 + file name 4. Android SQLite determines that the files in the database are empty
//Querying Data Public voidquery (view view) {Sqlitedatabase db=helper.getwritabledatabase (); Cursor Cursor= Db.query ("Fruitinfo",NULL,NULL,NULL,NULL,NULL,NULL); //is empty in the database, the dialog box pops up    if(!Cursor.movetofirst ()) {Alertdialog.builder Builder=NewAlertdialog.builder (mainactivity. This); Builder.settitle ("Sorry"); Builder.seticon (Android.        R.drawable.ic_btn_speak_now); Builder.setmessage ("There is no content in the database ..."); Builder.setpositivebutton ("OK",NULL); Builder.show (); //Show dialog Box}Else{//The database is not empty and jumps to another interfaceIntent Intent =NewIntent (); Intent.setclass (mainactivity. This, Main2activity.class);    StartActivity (Intent); }}

--------------I am the dividing line of the egg-----------------------

View SQLite database in Google Chrome [prepare: Google Chrome (Windows), Android Studio (2.0)]

1. Expand Gradle scripts→ Double-click Build.gradle (Module:app), add dependencies ' compile ' at the end of com.facebook.stetho:stetho:1.3.1

2. Create a new class and inherit application, adding a sentence stetho.initializewithdefaults (this) to the class;

3. Open Google Browser and enter Chrome://inspect in the address bar

4. Click on the Blue Inspect

5. appears, indicates completion.

Android file storage (at the end of the article there are eggs)

Related Article

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.