1. process attributes:
In the list, you can configure the process attribute for activity or serveice. You can specify that the process is executed in the thread of a package name, rather than the thread of the current package name.
android:process="com.rongqin.test"
2.OpenOrCreateDatabase method:
You can use the openOrCreateDatabase method to modify the database storage path.
SQLiteDatabase.openOrCreateDatabase(file, factory);
References: http://blog.csdn.net/wangqilin8888/article/details/7903048
3. Solution to url Chinese Character garbled characters:
The URLEncoder. encode (String) method encodes the Chinese parameters in the url to solve the garbled problem.
Public class TestUrlEncode {public static void main (String [] args) {String url = "http://www.xinboedu.com/"; String getParam = "? Key1 = Aston "; String newUrl = URLEncoder. encode (getParam); System. out. println (newUrl); // print the result: % 3Fkey1% 3D % E9 % 98% BF % E6 % 96% AF % E9 % A1 % BF }}
4.Flag_activity_new_task:
Start a program. You can click the icon on the main interface to enter the program. You can also jump from a program. The difference is that the activity is configured in manifest, which may be placed in different task stacks ).
If intent sets flag_activity_new_task,The effect is the same as that when the icon is started, that is, rebuilding a stack. Otherwise, the task is added to its own stack.
5. How to completely release list container objects in GC: Gabage Collection:
Private ArrayList <List> list = new ArrayList <List> (); public void onDestroy () {super. onDestroy (); list. clear (); // first clear the elements in the list and clear the reference list = null for the elements; // clear the reference to the list}
6. Cache Optimization:
1. page loading and image compression are preferred.
2. In addition, you can use the level-1 cache to release bitmap objects in the memory by using the bmp. recycle () method before adding them to the level-2 cache.
3. inert Loading
4. Weak references
public void ruo(){ WeakReference<MediaPlayer> player = new WeakReference<MediaPlayer>(new MediaPlayer()); MediaPlayer mediaPlayer = player.get(); mediaPlayer.start();}
7. Principle of resumable data transfer:
1. Application of the append Method
2. randomAccessFile (this class is required to read any location in the file field)
3. The number of downloaded bytes is saved to the database and stored on the get or post request server.
This article is from the "no trace in the sky but I fly over" blog. For more information, contact the author!