Questions about Android Getting data demo

Source: Internet
Author: User

Timestamps are data of type long, but other data are of type float, but asynctask requirements are uniform data types. So I can't put the time stamp into the asynctask, I'll get the timestamp in Doinbackground and then save it to the database. But a lot of the sensor data corresponding to the timestamp is the same, because there is no sensor changes once the database is stored once the data, but the sensor changes more than once the data exists cache, and then stored in the time of all these cached data storage.

The solution is still only through asynctask, this time you can consider storing all the data as a string type. This solves the problem of multiple data types, such as int, float, long, and so on.

Time stamp refers to the total number of seconds GMT January 01, 1970 00:00 00 seconds (Beijing time January 01, 1970 08:00 00 seconds) up to now.

For example, Beijing time 2015-12-31 17:00:00 time stamp is 1451552400, that is, from Beijing time 1970-01-01 08:00:00 to 2015-12-31 17:00:00 has passed 1,451,552,400 seconds.

The benefits of using timestamps in programming languages:
1, time stamp no time zone concept, such as if with ' 2015-12-31 17:00:00 ' such a string to represent time, Beijing time and the United States time is not the same, but with time stamp 1451552400来 expression, that is must be the only time, there will be no ambiguity;
2, timestamp in the programming language is generally a long-shaped data type, regardless of which programming language can recognize the timestamp, if the string to represent time, but also need to convert.

Questions about Android Getting data demo

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.