• The girl : Shanghai station is here ?
  • The boy : The one of ? To the world ~

  • The girl :Intent Core technology and data storage technology ?
  • The boy : Yes , Let's talk about this today ~

Intent It's used to communicate between components ,Intent The translation of “ Intention ” It means , It's the core object of transmitting data , It can open a activity, You can also send broadcast messages and turn on Service service , For them, it's through intent To call each other and coordinate their work .

Turn on activity:

adopt Intent Object delivery startActivity() and startActivityForResult() And onActivityResult() Method on activity.

Turn on Service:

startService() Method , To start a Service. And through bindService() Method to establish a link between the calling component and the service .

Pass on Broadcast:

The transmission of radio sendBroadcast(),sendOrderedBroadcast() or sendStickyBroadcast() Method .

Intent Object properties

Data storage technology

stay Android There are three ways of storage in :

SharedPreferences Storage

File File store

SQLite Database storage

ContentProvider Implement data sharing

1.SharedPreferences Storage

SharedPregerences It's a lightweight way to store data , It's usually used to store some simple data , Such as the configuration information of the application . Its essence is based on key-value Key value pairs are stored in , The storage type is int,long,String,float and boolean.

data SharedPreferences File storage directory :/data/data//shared_prefs/. Realization SharedPreferences Storage steps : call getSharedPreferences() Method , There are two parameters in getting this method :

getSharedPreferences(String name, int mode)

getPreferences(int mode)

Personal data interface module and SQLite Use of database

Learning goals :

master SQLite Use of database , It can save user's information with database ;
Learn to use personal data well , And the modification of personal data ;
Personal data includes user name , nickname , Gender , Signature ,QQ Number or personal social account records, etc .

Database creation

Data class inheritance extends SQLiteOpenHelper

Android Set and change the password , Set up a secret guard , And find the code :

Learning goals

Master the development of password modification function , And realize the modification of user password ;
Master the function development of setting security , Through security, we can retrieve the user's password , To ensure the safety of users .
The specific layout will not be shown , Only the realization of some function modules is explained .

For a project , It will be used many times in the project sharedPreferences Shared parameters , To store the user's login status or clear the login status ,“ I ” The interface also requires the method of reading user's name , So let's just throw all three methods to AnalysisUtils Inside .

stay Utils Create a new one in the package Java class , be known as AnalysisUtils.

File File store

Java A set of IO Flow system ,Android Write and read files in the same way , Provide FileOutputStream Class openFileOutput And to provide FileInputStream Class openFileInput() Method . This is internal storage , So external storage is ? External storage it uses Environment Class getExternalStorageDirectory() Method to read and write data .

Local data storage

Here's an introduction to Shared Preferences, Mainly with key-value stored .( Support boolean,int,float,long,string);Internal Storage High data security , Space is limited ;External Storage And Internal Storage contrary .

SharedPreferences It's a light data storage , be based on xml Key value pair storage of , Store some simple information .

SharedPreferences Only data can be obtained, not stored and modified , But it can pass. Editor Implement storage modification .

step :

obtain SharedPreferences object
SharedPreferences.Editor
Editor Of putXXX Methods
Editor.commit()

SQLite database

SQLite It's a lightweight system database , It's essentially binary , The so-called relational type , It's a relationship model , Here is the two-dimensional table structure pattern .

In a relational database , Columns in a two-dimensional table are properties , Called fields ; Behavior record , As an object ; Properties of the ( Field ) The range of values is called the field .

Here we're going to learn about databases , Such as DDL,DML etc. , Data definition language and data operation language , Create forms and add, delete, modify and query .

stay SQLite We need to understand SQLiteOpenHelper and SQLiteDatabase, And learn to use . And two ways rawQuery(): For queries and execSQL(): Used for adding, deleting, modifying and querying .

stay Android Provides SQLiteDatabase Create objects , The use does not need to write the database syntax encapsulation good API class . Use them separately query(),insert(),delete(),update() Express .

Here we are ok 了 , Next, I will continue to learn from higher places , Let's explore it slowly ~

Take a walk with the little gift or give the thumbs-up
 

Android The core technology Intent And data storage

  1. Spring Boot Unveiling and actual combat ( Two ) Data storage - Declarative transaction management

    List of articles 1.  Declarative transactions 2. Spring Boot Default integration transaction 3.  Practical drill 4.  Source code 3.1.  Entity object 3.2. DAO relevant 3.3. Service relevant 3.4.  test , test this paper ...

  2. Spring Boot Unveiling and actual combat ( Two ) Data storage - ElasticSearch

    List of articles 1.  Version notes 2.  Environment depends on 3.  data source 3.1.  Scheme 1 Use Spring Boot The default configuration 3.2.  Option two Manually create 4.  Business operations 5.  summary 4.1.  Entity object 4.2. D ...

  3. Spring Boot Unveiling and actual combat ( Two ) Data storage - MongoDB

    List of articles 1.  Environment depends on 2.  data source 2.1.  Scheme 1 Use Spring Boot The default configuration 2.2.  Option two Manually create 3.  Use mongoTemplate operation 4.  summary 3.1.  Entity object 3 ...

  4. Spring Boot Unveiling and actual combat ( Two ) Data storage - Redis

    List of articles 1.  Environment depends on 2.  data source 2.1.  Scheme 1 Use Spring Boot The default configuration 2.2.  Option two Manually create 3.  Use redisTemplate operation 4.  summary 3.1.  Tool class ...

  5. Spring Boot Unveiling and actual combat ( Two ) Data storage - JPA Integrate

    List of articles 1.  Environment depends on 2.  data source 3.  Script initialization 4. JPA Integration plan 1 By inheritance JpaRepository Interface 4.1.  Entity object 4.2. DAO relevant 4.3. Service relevant ...

  6. Spring Boot Unveiling and actual combat ( Two ) Data storage - MyBatis Integrate

    List of articles 1.  Environment depends on 2.  data source 3.  Script initialization 2.1.  Scheme 1 Use Spring Boot The default configuration 2.2.  Option two Manually create 4. MyBatis Integrate 5.  summary 4.1.  Scheme 1 adopt ...

  7. Spring Boot Unveiling and actual combat ( Two ) Data storage - Data access and multi data source configuration

    List of articles 1.  Environment depends on 2.  data source 3.  unit testing 4.  Source code In some cases , We may need to rely on and access multiple data sources in one application , For example, for MySQL The sub database scene of . therefore , We need to configure multiple data sources . ...

  8. Spring Boot Unveiling and actual combat ( Two ) Data storage - MySQL

    List of articles 1.  Environment depends on 2.  data source 3.  Script initialization 2.1.  Scheme 1 Use Spring Boot The default configuration 2.2.  Option two Manually create 4.  Use JdbcTemplate operation 5.  summary 4.1. ...

  9. Spring Boot Dry series :( 8、 ... and ) Data storage -SQL Relational database JdbcTemplate Use

    Spring Boot Dry series :( 8、 ... and ) Data storage -SQL Relational database JdbcTemplate Use original  2017-04-13  toot toot MD  DUYE java Supernatural school Preface The previous chapters cover some of the basics , But it's all quiet ...

Random recommendation

  1. Android-- The multithreading Handler

    Preface Android The message passing mechanism of is another form “ Event handling ”, The main purpose of this mechanism is to solve Android Multithreading in applications , stay Android You are not allowed to Activity The newly started thread accesses the Activity Inside U ...

  2. NY 269 VF

    subject seek 1—1000000000 Number between , The sum of its numbers is s. dp[i][j] Express i digit , The sum of its numbers is j Total number of . Let's assume that number two i Position as k, Before i - 1 The sum of bits should be j - k ...

  3. jQuery EasyUI datagrid How to achieve local paging

    http://www.codeweblog.com/jquery-easyui-datagrid%e5%ae%9e%e7%8e%b0%e6%9c%ac%e5%9c%b0%e5%88%86%e9%a1% ...

  4. About linux Memory usage

    From the perspective of operating system : System physical memory 7.5g It has been used at present 7.4g( contain 14m Of buffer and 1.6g Of cache) Remaining available memory 128m From an application perspective : It has been used at present 5.8g Remaining available memory 1.7g( because ...

  5. C Language —— Selection sort

    --- Resume content start --- Algorithmic thought : n The direct selection and sorting of records can go through n-1 The direct selection and sorting of passes get ordered results : ① The initial state : The disorder area is R[1..n], The ordered area is empty . ② The first 1 Trip to sort In the disordered zone R[1..n] Selected from ...

  6. kubernetes Installation notes

    One . Installation environment Alibaba cloud :centos 7.3 master node : Extranet IP(116.62.205.90). Intranet IP(172.16.223.200) node node : Extranet IP(116.62.212.174). ...

  7. Cannot load php5apache2_4.dll into server

    To configure PHP When developing the environment , When it comes to Apache Of httpd.conf File configuration loading PHP The following error has occurred while using the module httpd: Syntax error on line 185 of D:/wamp/Ap ...

  8. use curl Simulated entrainment cookie Of http request

    1. First, log in to the website you want to log in to , launch http request , obtain cookie 2. Get the real path of the request , Now the front end is like vue They all map back-end paths with custom paths , For example vue One of the requests in is caojiangjiang/t ...

  9. Java Basic knowledge of _ Bi Xiangdong _Java Basic video tutorial notes (5-10 object-oriented )

    06 God -05- object-oriented ( Help document making javadoc):java Document generation command :javadoc -d filepatn demo.java   -author -version( Optional ) By default, a class has a ...

  10. mktime and TZ

    mktime Bottom use __tz_convert, It may be slower http://blog.csdn.net/aquester/article/details/54669264 http://blog.csd ...