Android. The content package defines classes that are primarily used to access or publish data on devices, consisting of three of packages.
Content Sharing (android.content) is primarily used to share some data with each part of the application, and the main column has content provider,contentresolver for managing and publishing data. Intent,intentfilter is used to send messages between different components application.
Package Management (ANDROID.CONTENT.PM) is used to access the activities, Permissions, Services, signatures, and providers defined by the Android Package (. apk). The main class is Packagemanager.
Resource Management (Android.content.res) is used to access resources defined in the application, such as Strings,drawables, Media,device configuration, and so on, and the primary class is resource.
In general application the resources under the Res directory, in some cases application need to use some custom files, one way is to put them under the Res/raw directory, the other way is to put them in the assets directory, and Res Unlike directories, the Android SDK does not generate a resource ID for the files under the directory assets, but rather assetmanager the file name to the/assets directory organization, using Assetmanager access The same file structure is used. Assets provides a lower level of resource access than Res.
This example uses Assetmanager to access the Read_asset.txt in the assets directory.
InputStream is = Getassets (). Open ("Read_asset.txt");
We guarantee that this available method returns the total
//size of the asset ... Of course, this does mean the a single
//asset can ' t is more than 2 gigs.
int size = is.available ();
Read the entire asset into a local byte buffer.
byte[] buffer = new Byte[size];
Is.read (buffer);
Is.close ();
Convert the buffer into a string.
String text = new string (buffer);
Finally stick the string into the text view.
TextView TV = (TextView) Findviewbyid (r.id.text);
Tv.settext (text);
Assetmanager objects can be obtained by getassets () in activity, and file operations like Assetmanager can be read by byte stream.