After doing a few Android enterprise application projects, summarize the basic development steps of the project. Hope to communicate.
One application plan:
※ Determine the function.
※ necessary interface and interface to jump the flow.
* The source and format of the data and data required.
※ Service-side support is required.
※ Local database support is required.
※ Special permission is required.
※ Background service is required.
Two architecture design:
Hierarchical
※ Internet connection.
※ Data processing-xml, domain.
※ Package activity.
Three-Interface design:
※ The main interface is determined.
※ Module interface, list, view, edit interface.
※ Menu, Button, dialog box, prompt message.
※ Overall color of the interface.
Four data manipulation and storage:
※ Data source.
※ Data type.
※ Storage mode.
Five Business implementations:
※client Business Analysis.
Six page Jump:
※ Jump between each page.
※ Menu, button, event, etc.
Keyword:android app, Android develop, Android summary
Start the project from 2010.04 to now complete the main function module, share the development process and considerations.
Development environment: ubuntu7.10 +eclipse 3.5 + SDK
The following is a summary of development:
1. Source-code-based SDK and SDK Upgrade Considerations
o be familiar with the internationalization of resources
o be familiar with how it supports different screen sizes, different density media
o be familiar with its basic API and the supported minimum version number and API that is not supported
o Understand its layered architecture
o Upgrade SDK
§ Ensure that the platform supports the relevant Cglib version number (otherwise, to upgrade Ubuntu)
The simple way to do this is to remove the relevant ~/.android, remove the previous relevant version number, and then upgrade
§ Some resources (such as%s in strings) may need to be modified to adapt to the new version number
§ The new SDK may not contain the old version number 2.01
2. Emulator & Mobile
o operate emulator with ADB shell
§ http://www.javaeye.com/topic/260042
o push/pull file in emulator
§eclipse->window->show view->file explorer->pull A file from the device (or push a file onto the device)
o Connect USB with real mobile to test directly (mobile must be set to Develop/debug mode)
§ http://dimitar.me/ how-to-connect-your-android-phone-to-ubuntu-to-do-developmenttestinginstallations-or-tethering/
o emulator can be used for performance testing and functional testing. And mobile is more suitable for touch operation test and some view of the real show test
o Screen Size adaptation test (enumeration large, medium, small), screen orientation (enumeration horizontal, vertical screen), Task switch test
o Memory fit can only be tested on mobile
3. System Configuration Items
o sharedpreferences storage location and how to manually change on emulator
§ Find storage location: \data\data\your Package dir\shared_prefs\your XML files
§ According to the above Pull/push the file
o SQLite (sqlite3)
§ Default storage location: \data\data\your Package Dir\databases\your database name
§ According to the above with the ADB shell operation Emulator to do part of the database design and data updates
§ Design version number update and upgrade
o Other File I/O
§assert under File read
§ File permissions and read-write
o Interpreting Androidmanifest.xml
§application/process identification
§ The activity that starts at the beginning
The form of the §activity stack (designation taskaffinity&launchmode= "Singletask"), and the move to a new activity is with Intent.setflags (intent.flag_ Activity_reorder_to_front) in the form of
§ Required Permissions section
§ Supported minimum version number
4. view,context,manager -based development
o System view & Layout (layout is also view)
§ Use view itself as a separation between other layout
§ Frequently used View&layout:listview,scrollview,relativelayout,tablelayout
§ Design frequently used Style/theme drawable: http://idunnolol.com/android/drawables.html
§ Frequently used picture operations
§ Specify color rendering (setcolorfilter)
§ Trim
o Define your own view & Layout
§ Java code
1. public class touchlistview extends ListView { public Touchlistview (context context, AttributeSet attrs, int defstyle) {
2. }}
§ Java code
1. public class Toolbar extends linearlayout {
2. public Toolbar (final context context) {
3. Super(context);
4. }
5.
6. public Toolbar (final Context con, attributeset attrs) {
7. }
8.
9. }
o application,activity,service,view,intent
The relationship between §application,activity,service and context
The relationship between §view and context
§ Use application to make global variables between Activity,service,view (which is better than Singleton)
§ Use intent in Factory mode
§ Do activity jump
§sendbroadcast (real-time data exchange available with thread+ broadcastreceiver)
o use of WindowManager, Packagemanager, etc.
2. network IO
o java.net
o android.net
o Org.apache.http
§ Assume that he did not operate in the asynctask. Then his timeout setting must be less than 5 seconds (for ANR wait time)
§java.net. unknownhostexception
§ assumption occurs in emulator, can be tested: http://www.javaeye.com/topic/521023
§ Assuming that it occurs on mobile, it is usually a DNS resolution issue, or the user is agreed to retry the operation. or change the host domain name to public IP address
3. Drawing Section
o Draw on view
§ Just add a border to the original view
§ Java code
1. @Override
2. protected void dispatchdraw (canvas canvas) {}
§ Define the View yourself
§ Java code
1. @Override
2. protected void onDraw (canvas canvas) {
o Draw on the bitmap
§ Java code
1. Bitmap result = Bitmap.createbitmap (config.argb_8888);
2. Canvas canvas = new canvas (result);
3 .....
4. canvas.drawbitmap (result, rect, rect, paint);
2. Animations
O Frame Animation
§ Control the detection rate at 25FPS to make it smoother
O Gradient Animation
§ Pan
§ Zoom
§ Rotate
§ Transparent
3. ANR
o Build messages and message loop processing handler
o Use Asynctask
4. Exception & uncaughtexception
o Use Uncaughtexceptionhandler
5. Introducing third-party jars and sharing data with other apps
o Add a third-party jar via the Add user library
o Use of Content provider
6. Performance Optimization / Tuning
O optimized http://dl.javaeye.com/topics/download/774b3e9e-1c48-33bd-bc9d-5c27da998181 based on view
O Code-level specifications
O Method-level tuning
§method Profiling (assuming that the direct USB connection to mobile, requires root access to do this)
o GC Analysis
§ Use allocation Tracker
Source Document Download
Summary of Android_app project development steps