Summary of the invention
The object of the present invention is to provide a kind of APP method for managing resource and mobile terminals, are able to solve for each hand
The problem of inconvenience and repetitive work of release maintenance caused by different APP versions are issued in the compiling of machine terminal entries.
Technical solution provided by the invention is as follows:
The invention discloses a kind of APP method for managing resource, comprising: step 1 detects in privately owned catalogue when APP starts
With the presence or absence of resource file;Step 2 is if so, parsing and showing the resource file;Otherwise, the first money in copy system catalogue
Source file is used as resource file into the privately owned catalogue of APP, parses and shows the resource file.
The invention also discloses another APP method for managing resource, comprising: the resource of APP is packaged into the first money by step
Source file is built in system directory;Step 1 detects in privately owned catalogue when APP starts with the presence or absence of resource file;If step 2
It is to parse and show the resource file;Otherwise, the first resource file in copy system catalogue is into the privately owned catalogue of APP
As resource file, parses and show the resource file.
The invention also discloses another APP method for managing resource, comprising: when the resource of APP updates, will update
Resource be packaged into update resource file, the update resource file is built in system directory as first resource file;Step
Rapid 1 when APP starts, and detects in privately owned catalogue with the presence or absence of resource file;Step 2 is if so, parsing and showing the resource text
Part;Otherwise, the first resource file in copy system catalogue is used as resource file into the privately owned catalogue of APP, parses and shows
The resource file.
The invention also discloses another APP method for managing resource, comprising: the resource of APP is packaged into the first money by step
Source file is built in system directory;Step 1 detects in privately owned catalogue when APP starts with the presence or absence of resource file;Work as detection
There are when resource file, detect the first resource file stored in the resource file and system directory to be in privately owned catalogue
It is no identical;If they are the same, then it parses and shows the resource file;Otherwise, the resource file in privately owned catalogue is deleted, and is copied
The first resource file in shellfish system directory, as the resource file of APP, parses into privately owned catalogue and shows the money
Source file;Otherwise, the first resource file in copy system catalogue is used as resource file into the privately owned catalogue of APP, and parsing is simultaneously
Show the resource file.
The invention also discloses another APP method for managing resource, comprising: step, will when the resource of APP updates
The resource of update is packaged into update resource file, and the update resource file is built in system directory as first resource file
In;Step 1 detects in privately owned catalogue when APP starts with the presence or absence of resource file;When detecting in privately owned catalogue, there are resource texts
When part, whether identical the first resource file stored in the resource file and system directory is detected;If they are the same, then it parses
And show the resource file;Otherwise, the resource file in privately owned catalogue is deleted, and described in copy system catalogue
One resource file, as the resource file of APP, parses into privately owned catalogue and shows the resource file;Otherwise, copy system
First resource file in catalogue is used as resource file into the privately owned catalogue of APP, parses and shows the resource file.
It is further preferred that the first resource file includes picture and/or word string.
The invention also discloses a kind of mobile terminals, comprising: first detection module, for detecting privately owned when APP starting
It whether there is resource file in catalogue;Parsing module, for parsing and showing the resource file in privately owned catalogue;Copy mould
Block, for when resource file is not present in privately owned catalogue, the privately owned mesh of first resource file in copy system catalogue to APP
In record.
The invention also discloses another mobile terminals, comprising: first resource file generating module, for by the money of APP
Source is packaged into first resource file, is built in system directory;First detection module, for detecting privately owned catalogue when APP starting
In whether there is resource file;Parsing module, for parsing and showing the resource file in privately owned catalogue;Module is copied,
For when resource file is not present in privately owned catalogue, the privately owned catalogue of first resource file in copy system catalogue to APP
In.
The invention also discloses another mobile terminals, comprising: update module, for when the resource of APP updates,
The resource of update is packaged into and updates resource file as first resource file, and is built in system directory;First detection mould
Block, for detecting in privately owned catalogue with the presence or absence of resource file when APP starting;Parsing module, it is privately owned for parsing and showing
The resource file in catalogue;Module is copied, is used for when resource file is not present in privately owned catalogue, in copy system catalogue
First resource file into the privately owned catalogue of APP.
The invention also discloses another mobile terminals, comprising: first resource file generating module, for by the money of APP
Source is packaged into first resource file, is built in system directory;First detection module, for detecting privately owned catalogue when APP starting
In whether there is resource file;Parsing module, for parsing and showing the resource file in privately owned catalogue;Module is copied,
For when resource file is not present in privately owned catalogue, the privately owned catalogue of first resource file in copy system catalogue to APP
In;Second detection module, the resource text for the first resource file in detection system catalogue and in privately owned catalogue
Whether part is identical;Removing module, for when the first resource file in system directory and the resource file in privately owned catalogue
When not identical, the resource file in privately owned catalogue is deleted;The copy module is also used to when the first money in system directory
When the resource file in source file and privately owned catalogue is not identical, the first resource file in copy system catalogue is to private
Have in catalogue as resource file;The parsing module is also used to parse and show the resource file.
The invention also discloses another mobile terminals, comprising: update module, for when the resource of APP updates,
The resource of update is packaged into and updates resource file as first resource file, and is built in system directory;First detection mould
Block, for detecting in privately owned catalogue with the presence or absence of resource file when APP starting;Parsing module, it is privately owned for parsing and showing
The resource file in catalogue;Module is copied, is used for when resource file is not present in privately owned catalogue, in copy system catalogue
First resource file into the privately owned catalogue of APP;Second detection module, for the first resource in detection system catalogue
Whether file and the resource file in privately owned catalogue are identical;Removing module, for when the first resource text in system directory
When the resource file in part and privately owned catalogue is not identical, the resource file in privately owned catalogue is deleted;The copy mould
Block is also used to when the first resource file in system directory and the resource file in privately owned catalogue be not identical, copy system
The first resource file in catalogue is used as resource file into privately owned catalogue;The parsing module is also used to parse and show
The resource file.
It is further preferred that the first resource file includes picture and/or word string.
Compared with prior art, resource separation is gone out APK, not needed by the present invention in order to solve repeated cumbersome work
Resource compiling is packed into APK file, so that the same APK, different mobile phone terminals can be shared for different terminals project
Different resource needed for project only needs to change the resource file except APK.Mobile phone terminal projects different so only need to tie up
An APK file is protected, the repeatability and triviality of work are greatly reduced.
Specific embodiment
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, Detailed description of the invention will be compareed below
A specific embodiment of the invention.It should be evident that drawings in the following description are only some embodiments of the invention, for
For those of ordinary skill in the art, without creative efforts, it can also be obtained according to these attached drawings other
Attached drawing, and obtain other embodiments.
To make simplified form, part related to the present invention is only schematically shown in each figure, they are not represented
Its practical structures as product.In addition, there is identical structure or function in some figures so that simplified form is easy to understand
Component only symbolically depicts one of those, or has only marked one of those.Herein, "one" is not only indicated
" only this ", can also indicate the situation of " more than one ".
Fig. 1 is a kind of step schematic diagram of APP method for managing resource of the present invention, as a specific implementation of the invention
Example, as shown in Figure 1, a kind of APP method for managing resource includes: step 1 when APP starting, detecting whether there is in privately owned catalogue
Resource file;Step 2 is if so, parsing and showing the resource file;Otherwise, the first resource file in copy system catalogue arrives
It is used as resource file in the privately owned catalogue of APP, parses and shows the resource file.
This method is suitable for Android system.Resource separation is gone out APK by the present invention, does not need resource to be placed on APP engineering
Compiling is packed into APK file in catalogue, but resource is built in the system directory of mobile phone terminal, such as system/etc mesh
It records, in the storage inside path for resource being copied to program again in APP operation, then carries out parsing and show.
Specifically, the resource file includes picture and/or word string.It parses and shows that the resource file refers to resource
File is converted to the format that display unit can be shown.If picture, then BitmapFactory.decodeFile method is called
The path of incoming picture can obtain the image data of Bitmap format, then call ImageView control in display unit
The image data that setImageBitmap method is passed to the Bitmap format that front obtains can show picture in ImageView
In control and interface.
If word string, word string is written in xml document with string joint form in advance, by being solved in android system
The mode Pull of analysis XML parses the word string content in string node, then calls TextView control in display unit
SetText method is passed to the word string content that front obtains and can show word string in TextView control and interface.
Resource of the invention is not limited to and picture or word string, and the resource supported in any other android system is all answered
It is protected by this method.
Above-described embodiment is improved, obtains another APP method for managing resource, comprising: step beats the resource of APP
It is bundled into first resource file, is built in system directory;Step 1 detects in privately owned catalogue when APP starts with the presence or absence of resource text
Part;Step 2 is if so, parsing and showing the resource file;Otherwise, the first resource file in copy system catalogue is to APP's
It is used as resource file in privately owned catalogue, parses and shows the resource file.
Above-described embodiment is improved, another APP method for managing resource is obtained, comprising: step is sent out when the resource of APP
When raw update, the resource of update is packaged into update resource file, the update resource file is built-in as first resource file
In system directory;Step 1 detects in privately owned catalogue when APP starts with the presence or absence of resource file;Step 2 is if so, parse simultaneously
Show the resource file;Otherwise, the first resource file in copy system catalogue is into the privately owned catalogue of APP as resource text
Part parses and shows the resource file.
Above-described embodiment is improved, obtains another APP method for managing resource, comprising: step beats the resource of APP
It is bundled into first resource file, is built in system directory;Step 1 detects in privately owned catalogue when APP starts with the presence or absence of resource text
Part;When detecting in privately owned catalogue, there are when resource file, detect described first stored in the resource file and system directory
Whether resource file is identical;If they are the same, then it parses and shows the resource file;Otherwise, the money in privately owned catalogue is deleted
Source file, and the first resource file in copy system catalogue into privately owned catalogue as the resource file of APP, parsing is simultaneously
Show the resource file;Otherwise, the first resource file in copy system catalogue is into the privately owned catalogue of APP as resource text
Part parses and shows the resource file.
Above-described embodiment is improved, another APP method for managing resource is obtained, comprising: step is sent out when the resource of APP
When raw update, the resource of update is packaged into update resource file, the update resource file is built-in as first resource file
In system directory;Step 1 detects in privately owned catalogue when APP starts with the presence or absence of resource file;When in the privately owned catalogue of detection
It is whether identical there are the first resource file that stores in the resource file and system directory when resource file, is detected;If
It is identical, then it parses and shows the resource file;Otherwise, the resource file in privately owned catalogue, and copy system mesh are deleted
The first resource file in record, as the resource file of APP, parses into privately owned catalogue and shows the resource file;It is no
Then, the first resource file in copy system catalogue is used as resource file into the privately owned catalogue of APP, parses and shows the money
Source file.
Fig. 2 is a kind of flow chart of APP method for managing resource of the present invention.
S200 starts.
The resource of APP is packaged into first resource file by S201, is built in system directory, executes step S203.
S202 is packaged into update resource file, the more new resources when the resource of APP updates, by the resource of update
File is built in system directory as first resource file, executes step S203.
S203, which is detected, whether there is resource file in the privately owned catalogue of APP, if so, executing step S204;Otherwise, step is executed
Rapid S206.
Whether the first resource file in S204 detection system catalogue is identical as the resource file, if so, executing step
Otherwise S207 executes step S205.
S205 deletes the resource file in privately owned catalogue.
S206 decompresses the first resource file in simultaneously copy system catalogue to privately owned catalogue.
S207 is parsed and is shown the resource file.
Fig. 3 is a kind of composition schematic diagram of mobile terminal of the present invention, as a specific embodiment of the invention, such as Fig. 3
Shown, a kind of mobile terminal includes: first detection module 100, for when APP starting, detecting to whether there is in privately owned catalogue
Resource file;Parsing module 200, for parsing and showing the resource file in privately owned catalogue;Module 300 is copied, is used for
When resource file is not present in privately owned catalogue, the first resource file in copy system catalogue is into the privately owned catalogue of APP.
It is further preferred that the resource file includes picture and/or word string.
Specifically, parsing module 200 is converted to resource file the format that display unit can be shown.If picture, then
Call the path of the incoming picture of BitmapFactory.decodeFile method that can obtain the image data of Bitmap format, so
The setImageBitmap method of ImageView control in display unit is called to be passed to the figure for the Bitmap format that front obtains afterwards
Sheet data can show picture in ImageView control and interface.
If word string, word string is written in xml document with string joint form in advance, by being solved in android system
The mode Pull of analysis XML parses the word string content in string node, then calls TextView control in display unit
SetText method is passed to the word string content that front obtains and can show word string in TextView control and interface.
Above-described embodiment is improved, another mobile terminal is obtained, comprising: first resource file generating module 400,
For the resource of APP to be packaged into first resource file, it is built in system directory;First detection module 100, for being opened as APP
When dynamic, detect in privately owned catalogue with the presence or absence of resource file;Parsing module 200, for parsing and showing the institute in privately owned catalogue
State resource file;Module 300 is copied, is used for first when resource file is not present in privately owned catalogue, in copy system catalogue
Resource file is into the privately owned catalogue of APP.
First resource file generating module 400, it is in the publication of mobile phone terminal project rom version, this mobile phone terminal is corresponding
APP resource be packaged into a file according to path specified in resolution unit, be then built in system directory such as system/
It is issued together in etc with mobile phone terminal ROM.
Above-described embodiment is improved, another APP resource management system is obtained, comprising: update module 500 is used for
When the resource of APP updates, the resource of update is packaged into and updates resource file as first resource file, and is built in
In system directory;First detection module 100, for detecting in privately owned catalogue with the presence or absence of resource file when APP starting;Solution
Module 200 is analysed, for parsing and showing the resource file in privately owned catalogue;Module 300 is copied, for when in privately owned catalogue
There is no when resource file, the first resource file in copy system catalogue is into the privately owned catalogue of APP.
Fig. 4 is an a kind of specific embodiment composed structure schematic diagram of mobile terminal of the present invention, as shown in figure 4, to above-mentioned
Embodiment improves, and obtains another APP resource management system, comprising: first resource file generating module 400, being used for will
The resource of APP is packaged into first resource file, is built in system directory;First detection module 100, for examining when APP starting
It surveys in privately owned catalogue with the presence or absence of resource file;Parsing module 200, for parsing and showing the text of the resource in privately owned catalogue
Part;Module 300 is copied, for the first resource file when resource file is not present in privately owned catalogue, in copy system catalogue
Into the privately owned catalogue of APP;Second detection module 600, in detection system catalogue the first resource file with it is privately owned
Whether the resource file in catalogue is identical;Removing module 700, in the system directory first resource file with it is privately owned
When the resource file in catalogue is not identical, the resource file in privately owned catalogue is deleted;The copy module 300 is also used
In when the first resource file in system directory and the resource file in privately owned catalogue be not identical, in copy system catalogue
The first resource file into privately owned catalogue be used as resource file;The parsing module 200 is also used to parse and show institute
State resource file.
In android system, each APP has oneself governable privately owned catalogue, can use getFilesDir method
Acquisition/data/data/yourPackageName/files directory path.In APP starting, first detection module 100 is detected
It whether there is required resource file in privately owned catalogue, and if it exists, then parsing module 200 parses the resource file and shows;
If it does not exist, then it decompresses and the first resource file in copy system catalogue is literary as required resource into the privately owned catalogue of APP
Part further parses the resource file.
Fig. 5 is a kind of another specific embodiment composed structure schematic diagram of mobile terminal of the present invention.To above-described embodiment into
Row improves, and obtains another APP resource management system, comprising: update module 500, for when the resource of APP updates,
The resource of update is packaged into and updates resource file as first resource file, and is built in system directory;First detection mould
Block 100, for detecting in privately owned catalogue with the presence or absence of resource file when APP starting;Parsing module 200, for parsing and showing
Show the resource file in privately owned catalogue;Module 300 is copied, for copying when resource file is not present in privately owned catalogue
First resource file in system directory is into the privately owned catalogue of APP;Second detection module 600, in detection system catalogue
The first resource file and the resource file in privately owned catalogue it is whether identical;Removing module 700, for working as system mesh
When the resource file in first resource file and privately owned catalogue in record is not identical, the resource in privately owned catalogue is deleted
File;The copy module 300 is also used to when the first resource file in system directory and the resource text in privately owned catalogue
When part is not identical, the first resource file in copy system catalogue is used as resource file into privately owned catalogue;The parsing
Module 200 is also used to parse and show the resource file.
If desired resource file is updated, updated resource is packaged into update resource file by update module 500, in system
It is stored in catalogue, as first resource file.Specifically, the resource of update is packaged into another filename by the present invention, therewith
The filename of resource file in preceding privately owned catalogue possesses identical file header, but latter half difference to be to distinguish, such as
RES_01, RES_02.When copying the first resource file in 300 copy system catalogue of module into the privately owned catalogue of APP, save
The first resource filename of decompression, such as RES_01.When first detection module 100 detect had existed in privately owned catalogue it is required
When resource file, then the file started in searching system catalogue with RES, the first resource file RES_02 such as updated, and before
The RES_01 of preservation compares, if not identical, deletes existing resource file in the privately owned catalogue of APP, decompresses and copies again and is
In the privately owned catalogue of first resource file RES_02 to APP in catalogue of uniting, that is, complete the update of resource file.
Resource separation is gone out APK, resource compiling is not needed to be packed by the present invention in order to solve repeated cumbersome work
In APK file, so that the same APK can be shared for different mobile phone terminal projects, needed for different mobile phone terminal projects not
The resource file except APK is only needed to change with resource.Mobile phone terminal projects different so only need to safeguard an APK text
Part greatly reduces the repeatability and triviality of work.
It should be noted that above-described embodiment can be freely combined as needed.The above is only of the invention preferred
Embodiment, it is noted that for those skilled in the art, in the premise for not departing from the principle of the invention
Under, several improvements and modifications can also be made, these modifications and embellishments should also be considered as the scope of protection of the present invention.