[P000-009] transaction fee calculation system, 1.3

Source: Internet
Author: User

Two improvements
1. Some transaction parameters are made persistent, that is, (rate, other fees, etc.) and are automatically saved. You do not need to enter them again when you start the program next time.

Android standalone data persistence is generally used in three methods: 1. file stream. 2. (simple) SQLite database. 3. Use the SharedPreferences. Editor method to save it as an xml file and read it using SharedPreference.
The third method is the most convenient

The Editor has two Save Methods: apply and commit. The specific differences are as follows:
1. If no return value is applied, and a boolean value is returned by commit, it indicates whether the modification is submitted successfully.
2. apply is to submit the modified data atom to the memory, and then asynchronously submit it to the hardware disk, while commit is to submit it to the hardware disk synchronously. Therefore, when multiple concurrent commit commits, they will wait for the processed commit to be saved to the disk before the operation, thus reducing the efficiency. The "apply" function only submits atomic data to the content. The function that calls the "apply" function will directly overwrite the preceding memory data, which improves the efficiency to a certain extent.
3. The apply method does not prompt any failure prompts.
Because sharedPreference is a single instance in a process, there is generally no concurrency conflict. If you do not care about the submitted results, we recommend that you use apply. Of course, you must ensure that the submission is successful and there are subsequent operations, you still need to use commit.

For subsequent expansion, choose commit.

Ii. Added convertible bond computing
The calculation method is similar to that of other types of securities. The only difference is that the commission rate cannot exceed 1‰. You must determine the rate in advance. Finished Product download source code

 

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.