-
tránh tạo các đối tượng không cần thiết
-
sử dụng string buffer (multi thread) hoặc string builder cho việc append chiều chuỗi string
-
hai mảng a[] b[] tốt hơn so với (a,b)
-
Nếu bạn không cần truy xuất vào các biến của object. Có thể làm cho phương thức của bạn thành static. Lúc đó việc gọi hàm sẽ nhanh hơn khoảng 15-20%. Việc này cũng có một lợi thế nữa là method của bạn khi được gọi cũng không làm ảnh hưởng đến object
-
Use Static Final For Constants, const int BIT BETTER than enum
-
bên trong class thì bạn luôn luôn nên truy xuất trực tiếp vào biến (tránh gọi qua setter )
-
foreach > fori
-
cố gắng giảm thiểu độ sâu của layout
-
(nên dùng leakcanary)
- đóng các stream,lisnter, service để tránh leak
- tối đa sử dụng Application Context, nếu cần thiết activity context sử dụng weak reference ( check null )
- chú ý static inner class có thể keep strong reference đến outer class (RxJava instead of asynctask or loader )
-
sử dụng support percent thay layout weight
-
sử dụng okhttp (retrofit) hoặc voley thay cho apache httpclient mặc định
-
luôn luôn sử dụng proguard cho các bản release build
-
Sử dụng RxAndroid hoặc service, loader thay cho async
-
Use Optimized Datacontainers
SparseArray
SparseBooleanArray
SparseIntArray
SparseLongArray
LongSparseArray
-
Try to avoid static variables or objects as much as possible if they are not final constants. Static variables pose the threat of having references in other classes, which we might forget about and thus cause a memory leak
Last active
March 10, 2016 08:33
-
-
Save vuhung3990/915f2f09df3b560dee65 to your computer and use it in GitHub Desktop.
My Android Note
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment