Personal first AndroidApp development summary (201509)

Development summary (201509, Merrick):

This APP is the first attempt to develop an Android desktop APP with ADT-Eclipse.

1. The UI design
 interface adopts the method of paging. Each page displays a series of components, providing adding and checking functions. You can slide between each page by sliding the phone screen; the page label is at the top, which can indicate the name of the current page;
 data Data can be entered in the input pagination, which displays the descriptions and input controls of the input controls corresponding to different data items line by line.
 The query pagination can query data and display it in the form of a table, and can use different style backgrounds for odd and even rows. The top of the pagination is an input box and a button (the same row) for inputting query conditions, and most of the lower part displays the query result table.
 Each pagination uses a linear layout (LinearLayout).
 There are Layout files for each pagination.
 The main Activity corresponds to a ViewPager layout file.

2. Component design
 paging frame view group (ViewGroup) adopts ViewPager and PagerTabStrip;
 data entry paging adopts DatePickerDialog, EditText, TextView, Button, Spinner, obtains data of date, text, and numerical type, and displays it;
 query paging adopts EditText, Button input Query the conditions and query, the ListView control (including each row of TextView and View as the list Item) displays the table data;

3. The process design
 adopts an Activity, which initializes the adapter and event binding in a class, and closes the database when onDestroy;
 starts to initialize 4 paging Views and 4 titles, adds List to each, and
 establishes the adapter PagerAdapter of ViewPager: the current pagerAdapter is generated each time it slides. Paging component, destroy the current component when sliding switch.
 Input paging:
  Bind the date button event in the form of DatePickerDialog, the
  drop-down box Spinner obtains the paging view from the global component List and initializes, binds the adapter, binds the selection event, and binds the
  submit button to the click event to trigger the action of saving data to Sqlite data .
  Prompt the result of the operation with the Toast control.
 Data query paging:
  The input control obtains and judges the input content, the button submits triggers the query, displays the data event,
  queries the sqlite database, and sets the ListView adapter (inheriting the SimpleAdapter class to display the ListView content in a more diverse and personalized manner), which requires List< Map> as the query result data, the column name (Map key name) array, and the ID data of the corresponding Layout component are filled into the adapter as parameters.
4. The database design is
 a single-table sqlite database, inherits the SQLiteOpenHelper class, and establishes the initial database (sql statement) in the onCreate method;
 when it is necessary to update the database table structure, you can initialize the SQLiteOpenHelper inheritance class object, and pass in different values ​​at the calling place. The version parameter (initially 1);
 when querying, use Cursor to get results and use while iteration.

5. For the Sqlite database *.db file
 to directly access the db file on the mobile phone (and simulator) device, the root permission of the mobile phone is required. Currently unavailable.
 On the PC, you can use the adb tool (requires root authority) to access the db file on the device, upload and download the db file, and the sqlite tool to access the db database to execute sql. Files on the device can be viewed with ADT's DDMS (file permissions required).
 Using the file manager on the PC cannot access the private files on the device, and the private files assigned to each app are hidden.

 The sqlite plug-in of firefox can correctly view the Chinese content in the db file obtained on windows, and the sqlite command line accesses the db file on windows (regardless of whether the console utf-8, 65001 encoding is changed) Chinese garbled.
 The sqlite command line directly accesses the Chinese content of the db file on the virtual device (root privilege) to display correctly.
 The db file path on the device: /data/data/com.test.test4tabs/databases/familyfee.db, private, and cannot be seen in the resource manager for the user assigned when the app is installed.
 

6. For the xml file
 AndroidManifest.xml in the Android project: project configuration file, involving versions, activities, filters, permissions... There are many contents; the
 resource folder includes: the layout file is the design file of the UI control layout ,
   menu is related to pop-up menu,
   resources tag includes: array string-array, color color, string string, style style

7. The library used,
 such as the ViewPager control, is a component in sdk\extras\android\support\v4\android-support-v4.jar;

8. The content that has not yet been covered
 does not involve Intent, conversion between multiple activities, Broadcast Receiver, Services, security and permission

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326008512&siteId=291194637