快捷导航

开发Android App的建议2024/1/24

[复制链接]
查看: 17|回复: 0
发表于 2024-1-24 14:45:10 | 显示全部楼层 |阅读模式
真的挺后悔自己高中没好好学习,自己曾是湖北八校之一的学生,毕业之后看着自己的同学不是985就是211,也许当时可能觉得没啥差距,但是真就一本管学习,二本管纪律,三本管卫生,985大学的教学模式和方法以及教育资源,真的不是二本,三本可以比的,希望大家都可以好好学习,我个大学生看个这个,快感动死了。

  影响产品效率的每个问题(例如功耗或内存使用)都会影响应用程序的成功。 这就是为什么在开发过程中确保优化,平稳运行以及Android系统没有问题的必要性。键光科技网http://jstq365.com的其他知识和内容也可以到网站具体了解一下,我们是领域内专业的企业平台,欢迎您的关注和了解!

  首先,您需要减少APP的运行时间

  如何有效地使用线程

  取消后台某些线程的操作

  我们知道应用程序执行的所有操作都默认在主线程(用户界面的线程)中执行,因此应用程序的响应速度将受到影响。 这可能导致程序崩溃,甚至系统错误。

  要加快响应速度,必须将网络查询,数据库操作或复杂计算从主线程移动到单独的线程。 最有效的方法。 您可以使用IntentService创建后台操作。

  但是在使用IntentService时需要了解一些限制:

  此类不会将信息传递给用户界面。

  一次只能处理一个请求;

  每个流程请求流程都不能被中断。

  - 初始化线程中的查询操作

  当在后台处理查询操作时,表示数据不是即时的,但是可以使用CursorLoader工具来加速交互,所以你的 活动与用户之间的互动不会受到影响。

  使用此工具后,您的APP将启动ContentProvider查询单独后台线程,并在查询完成后,将结果返回给调用请求。

  - 优化设备电池的使用寿命

  如果您的APP消耗太多电量,用户卸载您的APP就不足为奇了。 这就是为什么你应该尝试在使用APP时减少电池消耗。 例如,避免在更新数据时唤醒程序,并将文本数据转换为非JIT正则表达式操作。

  - 优化网络

  如果您没有网络连接,请让您的应用程序忽略网络操作,并仅在有网络连接且没有漫游时更新数据。

  选择兼容的数据格式,将包含文本数据和二进制数据的所有请求转换为二进制数据格式请求。 必须使用有效的转换工具。

  我建议您获得更快的用户体验,因此您需要避免重复访问服务器。

  GZIP库是压缩文本数据以有效使用CPU资源的好工具。

  - 优化上游应用程序的工作

  为防止潜在错误导致能耗,请指定超时时间。

  如果可以,则使用粗定位网络而不是GPS.Le比较GPS要求1毫安(25 * S140毫安),而一般网络仅使用0.1毫安(2秒* 180 MA)。

  在使用DisplayMetrics执行DPI任务时,请考虑在大量数学运算中使用低精度变量并缓存变量值。

  - 优化前台工作的应用

  重要的是要确保服务的生命周期是短暂的,因为每个过程需要2 MB的内存,当领先的程序需要内存将被重新启动。 我们必须保持使用的内存量不要太大

  你必须检查电池状态并进行批量更新前的网络,并且它也建议进行的重要替代操作之前要等待最佳的状态。

  在后台执行操作时,让用户看到电源的使用非常重要,例如更新周期。

  - 实现低内存使用用户界面

  如何找到显示布局的问题

  当一个独立的用户界面来创建布局,然后占用过多的内存,然后创建,所以会出现在用户界面的开发延迟的应用程序。

  您可以使用Lint工具,它解析APP的源代码以检查错误并优化控制结果。

  布局问题

  如果您的布局有问题,那么您需要简化其结构。 您可以将LinearLayout类型转换为RelativeLayout类型,这将减少演示文稿的层次结构。

  Suggestions for developing Android APP

  Every issue that affects product efficiency, such as power consumption or memory usage, can affect the success of your application. This is why it is necessary to ensure optimization, smooth operation and no problems with the Android system during the development process.

  First, you need to reduce the running time of the app.

  How to use threads effectivelyCancel the operation of some threads in the background

  We know that all operations performed by the application are executed by default in the main thread (thread of the user interface), so the response speed of the application will be affected.  This can lead to program crashes and even system errors.

  To speed up the response, network queries, database operations, or complex calculations must be moved from the main thread to a separate thread it’s the most effective way. You can use the IntentService to create background operations.

  But there are some limitations to be aware of when using the IntentService:

  This class does not pass information to the user interface.

  Only one request can be processed at a time.

  Each process request process cannot be interrupted.

  - Initialize the query operation in the thread

  When processing query operations in the background, the data is not immediate, but the CursorLoader tool can be used to speed up the interaction, so your interactions with the user are not affected.

  After using this tool, your app will start the ContentProvider query for a separate background thread and return the result to the call request after the query is completed.

  - Optimize the battery life of your device

  If your app consumes too much power, it’s no surprise that users uninstall your app.  This is why you should try to reduce battery consumption when using the app.  For example, avoid waking up the program when updating data and converting text data to non-JIT regular expression operations.

  - Optimized network

  If you don't have a network connection, ask your app to ignore network operations and update data only if there is a network connection and there is no roaming.

  Select a compatible data format to convert all requests containing text data and binary data into binary data format requests.  A valid conversion tool must be used.

  I recommend that you get a faster user experience, so you need to avoid having to access the server repeatedly.

  The GZIP library is a good tool for compressing text data to use CPU resources efficiently.

  - Optimize the work of upstream applications

  To prevent potential errors from causing energy consumption, specify a timeout period.

  If possible, a coarse positioning network is used instead of GPS. Le compares GPS requirements to 1 mA (25 * S140 mA), whereas a typical network uses only 0.1 mA (2 seconds * 180 MA).

  When performing DPI tasks with DisplayMetrics, consider using low-precision variables and caching variable values in a large number of mathematical operations.

  - Optimize the application of foreground work

  It's important to make sure that the service lifecycle is short-lived because each process requires 2 MB of memory, and when the leading program needs memory it will be restarted.  We must keep the amount of memory used too large

  You must check the battery status and make a network before the batch update, and it also recommends waiting for the best state before performing an important alternative.

  When performing operations in the background, it is important for users to see the use of power, such as the update cycle.

  - Implement low memory usage user interface

  How to find the problem with the display layout

  When a separate user interface is used to create the layout, then it takes up too much memory and then creates, so the application delays in the development of the user interface appear.

  You can use the Lint tool, which parses the source code of the app to check for errors and optimize control results.

  Layout problem

  If you have a problem with your layout, you need to simplify its structure. You can convert the LinearLayout type to a RelativeLayout type, which will reduce the hierarchy of the presentation.

  举报/反馈
作为一个24岁还在读大三的老阿姨,给大家一个忠告,一定一定要努力学习,考上好大学。你只有真正经历过了,才知道没有学历,你甚至连一个机会都得不到。我现在专升本上了大学,在我专科实习的时候,我有一个同学特别优秀,基础很扎实,带他的老师也很喜欢他,但就因为他是专科毕业,最终没能留在那里。而且考研,有很多学校是明确专硕不收专升本学生的(就我的专业来说),只能考学硕。没有一个本科学历真的很难,尤其是在我们都是普通人的情况下。即使你现在很迷茫,但你也必须努力学习,考上好大学,这样后来你希望改变,也比由专科挣扎轻松得多。大家现在都还很年轻,珍惜你们现在无尽的可能性,我已经因为自己的选择,失去了很多机会。以我为鉴,与君共勉。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

精彩推荐

让学习更简单

  • 反馈建议:麻烦到学习网管理处反馈
  • 我的电话:这个不能给
  • 工作时间:周一到周五

关于我们

云服务支持

精彩文章,快速检索

关注我们

Copyright 学习网  Powered by©  技术支持:飛     ( 闽ICP备2021007264号-3 )