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 Permissions:
CHOMDExample: 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)