Best Practices for Web App
1. Redirect mobile devices to a dedicated mobile version of your web site
you should look for the "mobile" string in the User Agent
2. Use a valid markup DOCTYPE that's appropriate for mobile devices
XHTML (not allow HTML frames and nested tables)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">
3. Use viewport meta data to properly resize your web page
In your document <head>, set the browser's viewport to render your web page
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
Targeting Screens from Web Apps.
4. Avoid multiple file requests
avoid loading extra files such as stylesheets and script files in the <head>
optimize the size and speed of your files by compressing them with tools like Minify.
5. Use a vertical linear layout
Scrolling up and down is easier. (dont use left and right)
Best Practices - Designing for Performance
1. Optimize Judiciously
the best decisions about data structures and algorithms
Android-specific micro-optimization
2. Avoid Creating Unnecessary Objects
memory will be reduced
3. Performance Myths, JIT
-----
4. Prefer Static Over Virtual
static method can called without using the object.
If you don't need to access an object's fields, make your method static
5. Avoid Internal Getters/Setters
within a class you should always access fields directly
getter and setter will use objects
6. Use Static Final For Constants
Memory in the disk retained as in the same place for static.
Final variable's value will not be changed.
Final method cant be override.
7. Use Enhanced For Loop Syntax
for (Foo a : mArray) {
sum += a.mSplat;
}
8. Consider Package Instead of Private Access with Private Inner Classes
------
9. Use Floating-Point Judiciously
----
should prefer double to float
10. Know And Use The Libraries
----
11. Use Native Methods Judiciously
----
Best Practices for User Interfaces
Top 10 best practices for developing user interfaces for Android applications
1. UI guidelines - icons, widgets, activities, and menus
1. Icon Design Guidelines and Android Icon Templates Pack »
2. Widget Design Guidelines
3. Activity and Task Design Guidelines
4. Menu Design Guidelines
2. Understand and design for touch mode
1. The relationship between touch mode, selection, and focus means you must not rely on selection and/or focus to exist in your application. A very common problem with new Android developers is to rely on ListView.getSelectedItemPosition().
2. In touch mode, this method will return INVALID_POSITION. You should instead use click listeners or the choice mode.
3. Focusable in Touch Mode - For receive text input, like EditText or, when filtering is enabled, ListView.
4. Make sure that buttons and UI widgets are large enough for a touch interface.
3. But, support multiple interaction modes
-------
4. Use notifications and the window shade
------
1. Redirect mobile devices to a dedicated mobile version of your web site
you should look for the "mobile" string in the User Agent
2. Use a valid markup DOCTYPE that's appropriate for mobile devices
XHTML (not allow HTML frames and nested tables)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">
3. Use viewport meta data to properly resize your web page
In your document <head>, set the browser's viewport to render your web page
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
Targeting Screens from Web Apps.
4. Avoid multiple file requests
avoid loading extra files such as stylesheets and script files in the <head>
optimize the size and speed of your files by compressing them with tools like Minify.
5. Use a vertical linear layout
Scrolling up and down is easier. (dont use left and right)
Best Practices - Designing for Performance
1. Optimize Judiciously
the best decisions about data structures and algorithms
Android-specific micro-optimization
2. Avoid Creating Unnecessary Objects
memory will be reduced
3. Performance Myths, JIT
-----
4. Prefer Static Over Virtual
static method can called without using the object.
If you don't need to access an object's fields, make your method static
5. Avoid Internal Getters/Setters
within a class you should always access fields directly
getter and setter will use objects
6. Use Static Final For Constants
Memory in the disk retained as in the same place for static.
Final variable's value will not be changed.
Final method cant be override.
7. Use Enhanced For Loop Syntax
for (Foo a : mArray) {
sum += a.mSplat;
}
8. Consider Package Instead of Private Access with Private Inner Classes
------
9. Use Floating-Point Judiciously
----
should prefer double to float
10. Know And Use The Libraries
----
11. Use Native Methods Judiciously
----
Best Practices for User Interfaces
Top 10 best practices for developing user interfaces for Android applications
1. UI guidelines - icons, widgets, activities, and menus
1. Icon Design Guidelines and Android Icon Templates Pack »
2. Widget Design Guidelines
3. Activity and Task Design Guidelines
4. Menu Design Guidelines
2. Understand and design for touch mode
1. The relationship between touch mode, selection, and focus means you must not rely on selection and/or focus to exist in your application. A very common problem with new Android developers is to rely on ListView.getSelectedItemPosition().
2. In touch mode, this method will return INVALID_POSITION. You should instead use click listeners or the choice mode.
3. Focusable in Touch Mode - For receive text input, like EditText or, when filtering is enabled, ListView.
4. Make sure that buttons and UI widgets are large enough for a touch interface.
3. But, support multiple interaction modes
-------
4. Use notifications and the window shade
------
No comments:
Post a Comment