Android course Summary (III): android Course

Source: Internet
Author: User

Android course Summary (III): android Course

1. proguard obfuscation: Do not confuse activities or other functions; otherwise, the system will not be able to find the lifecycle function; the JSON string should consider whether the field name will be affected after obfuscation; the native method will not be confused; otherwise, the method cannot be called.

2. When the onItemLongClickListener of ListView returns true, onItemClick is no longer called.

3. Make good use of the singleton Mode

4. what we get from the sharing meeting: Which of the following is the priority for important and urgent matters? The answer is the priority for important matters. The order of handling should be: important, urgent, important, urgent, or urgent. First, important things are generally correct, but urgent things are not necessarily correct. Second, important things have the smallest proportion, no urgent and no important things are the most important. If we choose to deal with urgent and unimportant things first, the important and not urgent things will become urgent because of their importance, then we will be stuck in a loop of continuous handling of important and urgent events, which is a very unfavorable working state.

5. Use tomato for self-Planning and Training

6. right-click the project -- Properties -- Android, and check the is Library as the Library Project. Click add to introduce the project Library. (My Eclipse has a problem, which may be caused by my own configuration, you cannot use an absolute path project library. You can only use a relative path and check it later)

7. the Application layer is located at the bottom layer, and the system layer is located at the top layer. The Application cannot shield the Home Key, while the Dialog layer is higher than the Application layer. Therefore, a transparent Dialog can be used to shield the Application.

8. If there is an inexplicable error: If the possible type conversion is abnormal, the imported Package reports an error, and so on, trying to clean the project may solve the problem.

9. clampViewPositionVertical returns the position of the dragged sub-View next moment. If return 0 is returned, the drag View will appear directly on the leftmost side.

10. automatic Target Mode: Unable to detect device compatibility. please select a target device. when other projects can run but some projects report this error, right-click propertites and choose Android, select your mobile phone system version, change it in the configuration file, and reinstall it.

11.

-------------------------- Android 4 advanced programming learning abstract ------------------------------------

1. The apply method in SharedPreferences is introduced after API 9. Calling It securely writes data to the SP Editor asynchronously. Because it is asynchronous, it is the preferred method to save the SP. To ensure that the operation is successful, or to support earlier Android versions, you can call the commit method, which blocks the calling thread and returns true after the write is successful, if the write fails, false is returned.

2. Unlike the standard UI layout, the preferences are defined in the res/xml resource folder.

3. The Android platform before Android 3.0 (api level 11) does not support PreferenceHeader and Preference Fragment. You can directly add PreferenceScreen in Preference Activity.

4. If the Activity is destroyed and restarted to handle hardware configuration changes (such as screen orientation changes), you can request to keep the Fragment status. By calling setRetainInstance in the onCreate handler of Fragment, the Fragment instance should not be terminated or restarted when the Activity associated with Fragment is re-created. Therefore, when the device configuration changes and the Activity associated with the retained Fragment is destroyed and re-created, the onDestroy and onCreate handlers of the retained Fragment will not be called. If you move most of the object creation code to onCreate and use the values stored in onCreateView and saved instance values to update the UI, this can significantly improve the efficiency.

5. If an application requires external file resources, you can place them in the res/raw folder of the Project hierarchy to include them in your own distribution package. To access the file, use the openRawResouce method of the Resouce object to receive an InputStream Based on the specified file. The input file name (without the extension) is used as the variable name of the R. raw class.

6. large or previously existing data sources (such as dictionaries) are not suitable for (or even impossible) conversion to the Android database. At this time, adding original files to the resource hierarchy is a good solution.

7. If the application needs to cache temporary files, Android provides a manageable internal cache and (starting from API 8) an unmanageable external cache. Call the getCacheDir and getExternalCacheDir methods to access them from the current context.

8. SQLite uses a loose type method in column definition. That is, all values in a column are not required to be of the same type. On the contrary, the type of each value is set in each row. In this way, strict type check is not required when values are allocated or extracted from each column of each row.

9. It is a good practice to create and open databases when databases are needed. SQLiteOpenHelper caches the database instances after they are successfully opened. Therefore, you can request to open the database before executing a query or transaction. For the same reason, you do not need to close the database unless you no longer need to use the database.

10. Because database operations take a long time to complete, to ensure that these operations do not affect user experience, all database transactions should be executed asynchronously.

11. If the disk space is insufficient or you do not have sufficient permissions, the call to getWritableDatabase may fail. Therefore, getReadableDatabase should be used as a backup when you need to query the database. In most cases, it provides the same, cached, writable database instance as getWritableDatabase, unless the database instance does not exist, or has the same permissions or disk space problems, then it returns a read-only copy of the database instance.

12. before creating or upgrading a database, you must open the database in writable form. Therefore, in general, the best practice is to first try to open the writable database. If it cannot be opened successfully, try to open the read-only database again.



Android development and learning process

Java learns asynchronous processing and multithreading, and then learns android

I don't have any computer basics. I have to learn about android, including java basics. How long will it take for me to learn about android?

First, you cannot be enthusiastic for three minutes. If not, you can proceed...
If you are self-taught, there is no foundation. Of course, you need to get started first. You can't get started with your own books. You need to download some basic java videos online and buy a basic java account, as long as you get started, it is much easier to learn.
To learn about Android, you only need to have the basics of java. It is easier to understand the syntax of Android.
So much, it's better to watch the video now and follow the teacher. Earnest + effort + enthusiasm = learning Android, becoming a master is hard to say, but at least it should be okay to write some small software by yourself, and there must be perseverance...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.